[FFmpeg-cvslog] r24963 - trunk/libavformat/rtpdec.c

mstorsjo subversion
Sun Aug 29 12:19:44 CEST 2010


Author: mstorsjo
Date: Sun Aug 29 12:19:44 2010
New Revision: 24963

Log:
rtpdec: Read RTCP compound packets

Patch by Josh Allmann, joshua dot allmann at gmail

Modified:
   trunk/libavformat/rtpdec.c

Modified: trunk/libavformat/rtpdec.c
==============================================================================
--- trunk/libavformat/rtpdec.c	Sun Aug 29 12:16:54 2010	(r24962)
+++ trunk/libavformat/rtpdec.c	Sun Aug 29 12:19:44 2010	(r24963)
@@ -74,12 +74,28 @@ void av_register_rtp_dynamic_payload_han
 
 static int rtcp_parse_packet(RTPDemuxContext *s, const unsigned char *buf, int len)
 {
-    if (buf[1] != RTCP_SR)
-        return -1;
+    int payload_len;
+    while (len >= 2) {
+        switch (buf[1]) {
+        case RTCP_SR:
+            if (len < 16) {
+                av_log(NULL, AV_LOG_ERROR, "Invalid length for RTCP SR packet\n");
+                return AVERROR_INVALIDDATA;
+            }
+            payload_len = (AV_RB16(buf + 2) + 1) * 4;
+
     s->last_rtcp_ntp_time = AV_RB64(buf + 8);
     if (s->first_rtcp_ntp_time == AV_NOPTS_VALUE)
         s->first_rtcp_ntp_time = s->last_rtcp_ntp_time;
     s->last_rtcp_timestamp = AV_RB32(buf + 16);
+
+            buf += payload_len;
+            len -= payload_len;
+            break;
+        default:
+            return -1;
+        }
+    }
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list