aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Scholz <epirat07@gmail.com>2025-04-25 18:19:04 +0200
committerMarvin Scholz <epirat07@gmail.com>2025-07-07 16:33:48 +0200
commitd2828ab28463fa2062e7d254f549cb434974c963 (patch)
treebafa7bcda0651812a2582a9fc171068289a98cbd
parent73d77693c507fc64ab1e58e27ba6a1fa8254922e (diff)
downloadffmpeg-d2828ab28463fa2062e7d254f549cb434974c963.tar.gz
avformat: rtsp: export AV_PKT_DATA_RTCP_SR
-rw-r--r--libavformat/rtpdec.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index f27ef106b4..405a900ce0 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -612,12 +612,30 @@ static int rtp_set_prft(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp) {
return 0;
}
+static int rtp_add_sr_sidedata(RTPDemuxContext *s, AVPacket *pkt) {
+ AVRTCPSenderReport *sr =
+ (AVRTCPSenderReport *) av_packet_new_side_data(
+ pkt, AV_PKT_DATA_RTCP_SR, sizeof(AVRTCPSenderReport));
+ if (!sr)
+ return AVERROR(ENOMEM);
+
+ memcpy(sr, &s->last_sr, sizeof(AVRTCPSenderReport));
+ s->pending_sr = 0;
+ return 0;
+}
+
/**
* This was the second switch in rtp_parse packet.
* Normalizes time, if required, sets stream_index, etc.
*/
static void finalize_packet(RTPDemuxContext *s, AVPacket *pkt, uint32_t timestamp)
{
+ if (s->pending_sr) {
+ int ret = rtp_add_sr_sidedata(s, pkt);
+ if (ret < 0)
+ av_log(s->ic, AV_LOG_WARNING, "rtpdec: failed to add SR sidedata\n");
+ }
+
if (pkt->pts != AV_NOPTS_VALUE || pkt->dts != AV_NOPTS_VALUE)
return; /* Timestamp already set by depacketizer */
if (timestamp == RTP_NOTS_VALUE)