[vlc-devel] Handling RTP Header Extension

Zohar Lorberbaum Zohar.Lorberbaum at harmonicinc.com
Fri Sep 30 02:47:10 CEST 2005


RFC 1889 allows for RTP header extensions. The extension bit, extension
profile, extension length and the actual header extension are not being
handled at the moment. This can cause having part of the RTP header to
be handled as payload, thus corrupting the actual payload content
playback.

Following is a patch to latest SVN version of
vlc-trunk/modules/access/udp.c which fixes this problem.

Cheers,
Zohar Lorberbaum


--- udp.c  2005-09-29 17:25:50.518065600 -0700
+++ udp-rtp-extension.c 2005-09-29 17:28:47.923161600 -0700
@@ -328,6 +328,8 @@
     int     i_payload_type;
     int     i_skip = 0;
     int     i_sequence_number = 0;
+    int     i_extension_bit = 0;
+    int     i_extension_length = 0;

     if( p_block == NULL )
         return NULL;
@@ -342,6 +344,11 @@
     i_payload_type = ( p_block->p_buffer[1] & 0x7F );
     i_sequence_number = ( (p_block->p_buffer[2] << 8 ) +
p_block->p_buffer[3] );

+    i_extension_bit  = ( p_block->p_buffer[0] & 0x10 ) >> 4;
+
+    if ( i_extension_bit == 1)
+        i_extension_length = ( (p_block->p_buffer[14] << 8 ) +
p_block->p_buffer[15] );
+
     if ( i_rtp_version != 2 )
         msg_Dbg( p_access, "RTP version is %u, should be 2",
i_rtp_version );

@@ -350,7 +357,7 @@
     else if( i_payload_type !=  33 && i_payload_type != 32 )
         msg_Dbg( p_access, "unsupported RTP payload type (%u)",
i_payload_type );

-    i_skip += RTP_HEADER_LEN + 4*i_CSRC_count;
+    i_skip += RTP_HEADER_LEN + 4*i_CSRC_count + 4*i_extension_bit +
4*i_extension_length;

     /* A CSRC extension field is 32 bits in size (4 bytes) */
     if( i_skip >= p_block->i_buffer )




-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list