ffmpeg | branch: master | Marvin Scholz <epira...@gmail.com> | Fri Apr 25 
18:19:04 2025 +0200| [d2828ab28463fa2062e7d254f549cb434974c963] | committer: 
Marvin Scholz

avformat: rtsp: export AV_PKT_DATA_RTCP_SR

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2828ab28463fa2062e7d254f549cb434974c963
---

 libavformat/rtpdec.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

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)

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to