PR #22524 opened by branko_s67
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22524
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22524.patch

This is needed for the application to be able to calculate packet UTC
times. The RTCP packet is sent as side data to the next AVPacket, but
there is no way to know how the timestamps in the RTCP packet relates
to the pts or dts in the AVPacket.

Change-Id: Iebc17036e1d21b3dc4ad48da540c22cd049030a1


>From c99c04210350ce0df350dd1cf3facffa7bb86990 Mon Sep 17 00:00:00 2001
From: Branko Subasic <[email protected]>
Date: Mon, 23 Feb 2026 11:31:10 +0100
Subject: [PATCH] lavf: add the RTP base time to RTCPSenderReport

This is needed for the application to be able to calculate packet UTC
times. The RTCP packet is sent as side data to the next AVPacket, but
there is no way to know how the timestamps in the RTCP packet relates
to the pts or dts in the AVPacket.

Change-Id: Iebc17036e1d21b3dc4ad48da540c22cd049030a1
---
 libavcodec/defs.h    | 1 +
 libavformat/rtpdec.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/libavcodec/defs.h b/libavcodec/defs.h
index b13e983b13..c6a941e172 100644
--- a/libavcodec/defs.h
+++ b/libavcodec/defs.h
@@ -348,6 +348,7 @@ typedef struct AVRTCPSenderReport {
     uint32_t rtp_timestamp; ///< RTP time when the report was sent
     uint32_t sender_nb_packets; ///< Total number of packets sent
     uint32_t sender_nb_bytes; ///< Total number of bytes sent (excluding 
headers or padding)
+    uint32_t base_rtp_timestamp; //< Base RTP time, obtained from the RTP-Info 
header
 } AVRTCPSenderReport;
 
 /**
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 5872c0f59c..dddcb17d89 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -197,6 +197,7 @@ static int rtcp_parse_packet(RTPDemuxContext *s, const 
unsigned char *buf,
             s->last_sr.rtp_timestamp = AV_RB32(buf + 16);
             s->last_sr.sender_nb_packets = AV_RB32(buf + 20);
             s->last_sr.sender_nb_bytes = AV_RB32(buf + 24);
+            s->last_sr.base_rtp_timestamp = s->base_timestamp;
 
             s->pending_sr = 1;
             s->last_rtcp_reception_time = av_gettime_relative();
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to