[vlc-commits] [Git][videolan/vlc][master] rtp out: fix AC-3 payload header

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Sun Dec 5 18:01:12 UTC 2021



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
1e902c11 by Rémi Denis-Courmont at 2021-12-05T17:43:29+00:00
rtp out: fix AC-3 payload header

This was complete garbage.

- - - - -


1 changed file:

- modules/stream_out/rtpfmt.c


Changes:

=====================================
modules/stream_out/rtpfmt.c
=====================================
@@ -944,6 +944,16 @@ static int rtp_packetize_ac3( sout_stream_id_sys_t *id, block_t *in )
     uint8_t *p_data = in->p_buffer;
     int     i_data  = in->i_buffer;
     int     i;
+    uint8_t hdr[2];
+
+    if (i_count <= 1)
+        hdr[0] = 0; /* One complete frame */
+    else if (i_data * 5 <= i_max * 8)
+        hdr[0] = 1; /* Initial fragment with at least 5/8th of frame */
+    else
+        hdr[0] = 2; /* Initial fragment with less than 5/8th of frame */
+
+    hdr[1] = i_count;
 
     for( i = 0; i < i_count; i++ )
     {
@@ -952,11 +962,8 @@ static int rtp_packetize_ac3( sout_stream_id_sys_t *id, block_t *in )
 
         /* rtp common header */
         rtp_packetize_common( id, out, (i == i_count - 1)?1:0, in->i_pts );
-        /* unit count */
-        out->p_buffer[12] = 1;
-        /* unit header */
-        out->p_buffer[13] = 0x00;
         /* data */
+        memcpy( &out->p_buffer[12], hdr, 2 );
         memcpy( &out->p_buffer[14], p_data, i_payload );
 
         out->i_dts    = in->i_dts + i * in->i_length / i_count;
@@ -966,6 +973,7 @@ static int rtp_packetize_ac3( sout_stream_id_sys_t *id, block_t *in )
 
         p_data += i_payload;
         i_data -= i_payload;
+        hdr[0] = 3; /* Fragment other than initial fragment */
     }
 
     block_Release(in);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1e902c11902cfb3744b5f7a2d66239ba97459f7f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1e902c11902cfb3744b5f7a2d66239ba97459f7f
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list