[FFmpeg-cvslog] rtpdec: Add a terminating null byte at the end of the SDES/CNAME

Martin Storsjö git at videolan.org
Thu Jan 10 13:02:42 CET 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed Jan  9 19:41:21 2013 +0200| [ed79093222ceb42f0c3a39095a69af0b32be5450] | committer: Martin Storsjö

rtpdec: Add a terminating null byte at the end of the SDES/CNAME

This is required by RFC 3550 (section 6.5):

   The list of items in each chunk MUST be terminated by one or more
   null octets, the first of which is interpreted as an item type of
   zero to denote the end of the list.

This was implicitly added as padding before, unless the host name
length matched up so no padding was added.

This makes wireshark parse the packets properly if other RTCP items
are appended to the same packet.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/rtpdec.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 4064e70..9734ecf 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -307,13 +307,14 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd,
     avio_w8(pb, (RTP_VERSION << 6) + 1); /* 1 report block */
     avio_w8(pb, RTCP_SDES);
     len = strlen(s->hostname);
-    avio_wb16(pb, (6 + len + 3) / 4); /* length in words - 1 */
+    avio_wb16(pb, (7 + len + 3) / 4); /* length in words - 1 */
     avio_wb32(pb, s->ssrc + 1);
     avio_w8(pb, 0x01);
     avio_w8(pb, len);
     avio_write(pb, s->hostname, len);
+    avio_w8(pb, 0); /* END */
     // padding
-    for (len = (6 + len) % 4; len % 4; len++)
+    for (len = (7 + len) % 4; len % 4; len++)
         avio_w8(pb, 0);
 
     avio_flush(pb);



More information about the ffmpeg-cvslog mailing list