Commit 1f5d476c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

rtp: remove mutually cancelling writes to block_t.i_buffer

rtp_packetize_common() overrode the correct value with 12, which was
then reset to the correct value.

Note: the AMR packetizer seems odd.
parent a1222364
...@@ -1649,7 +1649,6 @@ void rtp_packetize_common( sout_stream_id_sys_t *id, block_t *out, ...@@ -1649,7 +1649,6 @@ void rtp_packetize_common( sout_stream_id_sys_t *id, block_t *out,
memcpy( out->p_buffer + 8, id->ssrc, 4 ); memcpy( out->p_buffer + 8, id->ssrc, 4 );
out->i_buffer = 12;
id->i_sequence++; id->i_sequence++;
} }
......
...@@ -609,7 +609,6 @@ int rtp_packetize_xiph_config( sout_stream_id_sys_t *id, const char *fmtp, ...@@ -609,7 +609,6 @@ int rtp_packetize_xiph_config( sout_stream_id_sys_t *id, const char *fmtp,
SetWBE( out->p_buffer + 16, i_payload); SetWBE( out->p_buffer + 16, i_payload);
memcpy( &out->p_buffer[18], p_data, i_payload ); memcpy( &out->p_buffer[18], p_data, i_payload );
out->i_buffer = 18 + i_payload;
out->i_dts = i_pts; out->i_dts = i_pts;
rtp_packetize_send( id, out ); rtp_packetize_send( id, out );
...@@ -666,7 +665,6 @@ static int rtp_packetize_xiph( sout_stream_id_sys_t *id, block_t *in ) ...@@ -666,7 +665,6 @@ static int rtp_packetize_xiph( sout_stream_id_sys_t *id, block_t *in )
SetWBE( out->p_buffer + 16, i_payload); SetWBE( out->p_buffer + 16, i_payload);
memcpy( &out->p_buffer[18], p_data, i_payload ); memcpy( &out->p_buffer[18], p_data, i_payload );
out->i_buffer = 18 + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -702,7 +700,6 @@ static int rtp_packetize_mpa( sout_stream_id_sys_t *id, block_t *in ) ...@@ -702,7 +700,6 @@ static int rtp_packetize_mpa( sout_stream_id_sys_t *id, block_t *in )
SetWBE( out->p_buffer + 14, i * i_max ); SetWBE( out->p_buffer + 14, i * i_max );
memcpy( &out->p_buffer[16], p_data, i_payload ); memcpy( &out->p_buffer[16], p_data, i_payload );
out->i_buffer = 16 + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -802,7 +799,6 @@ static int rtp_packetize_mpv( sout_stream_id_sys_t *id, block_t *in ) ...@@ -802,7 +799,6 @@ static int rtp_packetize_mpv( sout_stream_id_sys_t *id, block_t *in )
memcpy( &out->p_buffer[16], p_data, i_payload ); memcpy( &out->p_buffer[16], p_data, i_payload );
out->i_buffer = 16 + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -839,7 +835,6 @@ static int rtp_packetize_ac3( sout_stream_id_sys_t *id, block_t *in ) ...@@ -839,7 +835,6 @@ static int rtp_packetize_ac3( sout_stream_id_sys_t *id, block_t *in )
/* data */ /* data */
memcpy( &out->p_buffer[14], p_data, i_payload ); memcpy( &out->p_buffer[14], p_data, i_payload );
out->i_buffer = 14 + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -872,7 +867,6 @@ static int rtp_packetize_split( sout_stream_id_sys_t *id, block_t *in ) ...@@ -872,7 +867,6 @@ static int rtp_packetize_split( sout_stream_id_sys_t *id, block_t *in )
(in->i_pts > VLC_TS_INVALID ? in->i_pts : in->i_dts) ); (in->i_pts > VLC_TS_INVALID ? in->i_pts : in->i_dts) );
memcpy( &out->p_buffer[12], p_data, i_payload ); memcpy( &out->p_buffer[12], p_data, i_payload );
out->i_buffer = 12 + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -906,7 +900,6 @@ static int rtp_packetize_swab( sout_stream_id_sys_t *id, block_t *in ) ...@@ -906,7 +900,6 @@ static int rtp_packetize_swab( sout_stream_id_sys_t *id, block_t *in )
(in->i_pts > VLC_TS_INVALID ? in->i_pts : in->i_dts) ); (in->i_pts > VLC_TS_INVALID ? in->i_pts : in->i_dts) );
swab( p_data, out->p_buffer + 12, i_payload ); swab( p_data, out->p_buffer + 12, i_payload );
out->i_buffer = 12 + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -960,7 +953,6 @@ static int rtp_packetize_mp4a_latm( sout_stream_id_sys_t *id, block_t *in ) ...@@ -960,7 +953,6 @@ static int rtp_packetize_mp4a_latm( sout_stream_id_sys_t *id, block_t *in )
memcpy( &out->p_buffer[12+latmhdrsize], p_data, i_payload ); memcpy( &out->p_buffer[12+latmhdrsize], p_data, i_payload );
out->i_buffer = 12 + latmhdrsize + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -1000,7 +992,6 @@ static int rtp_packetize_mp4a( sout_stream_id_sys_t *id, block_t *in ) ...@@ -1000,7 +992,6 @@ static int rtp_packetize_mp4a( sout_stream_id_sys_t *id, block_t *in )
memcpy( &out->p_buffer[16], p_data, i_payload ); memcpy( &out->p_buffer[16], p_data, i_payload );
out->i_buffer = 16 + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -1065,7 +1056,6 @@ static int rtp_packetize_h263( sout_stream_id_sys_t *id, block_t *in ) ...@@ -1065,7 +1056,6 @@ static int rtp_packetize_h263( sout_stream_id_sys_t *id, block_t *in )
SetWBE( out->p_buffer + 12, h ); SetWBE( out->p_buffer + 12, h );
memcpy( &out->p_buffer[RTP_H263_PAYLOAD_START], p_data, i_payload ); memcpy( &out->p_buffer[RTP_H263_PAYLOAD_START], p_data, i_payload );
out->i_buffer = RTP_H263_PAYLOAD_START + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -1109,7 +1099,6 @@ rtp_packetize_h264_nal( sout_stream_id_sys_t *id, ...@@ -1109,7 +1099,6 @@ rtp_packetize_h264_nal( sout_stream_id_sys_t *id,
/* */ /* */
rtp_packetize_common( id, out, b_last, i_pts ); rtp_packetize_common( id, out, b_last, i_pts );
out->i_buffer = 12 + i_data;
memcpy( &out->p_buffer[12], p_data, i_data ); memcpy( &out->p_buffer[12], p_data, i_data );
...@@ -1134,8 +1123,6 @@ rtp_packetize_h264_nal( sout_stream_id_sys_t *id, ...@@ -1134,8 +1123,6 @@ rtp_packetize_h264_nal( sout_stream_id_sys_t *id,
/* */ /* */
rtp_packetize_common( id, out, (b_last && i_payload == i_data), rtp_packetize_common( id, out, (b_last && i_payload == i_data),
i_pts ); i_pts );
out->i_buffer = 14 + i_payload;
/* FU indicator */ /* FU indicator */
out->p_buffer[12] = 0x00 | (i_nal_hdr & 0x60) | 28; out->p_buffer[12] = 0x00 | (i_nal_hdr & 0x60) | 28;
/* FU header */ /* FU header */
...@@ -1218,7 +1205,7 @@ static int rtp_packetize_amr( sout_stream_id_sys_t *id, block_t *in ) ...@@ -1218,7 +1205,7 @@ static int rtp_packetize_amr( sout_stream_id_sys_t *id, block_t *in )
/* FIXME: are we fed multiple frames ? */ /* FIXME: are we fed multiple frames ? */
memcpy( &out->p_buffer[14], p_data+1, i_payload-1 ); memcpy( &out->p_buffer[14], p_data+1, i_payload-1 );
out->i_buffer = 14 + i_payload-1; out->i_buffer--; /* FIXME? */
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -1269,7 +1256,6 @@ static int rtp_packetize_t140( sout_stream_id_sys_t *id, block_t *in ) ...@@ -1269,7 +1256,6 @@ static int rtp_packetize_t140( sout_stream_id_sys_t *id, block_t *in )
rtp_packetize_common( id, out, 0, in->i_pts + i_packet ); rtp_packetize_common( id, out, 0, in->i_pts + i_packet );
memcpy( out->p_buffer + 12, p_data, i_payload ); memcpy( out->p_buffer + 12, p_data, i_payload );
out->i_buffer = 12 + i_payload;
out->i_dts = in->i_pts; out->i_dts = in->i_pts;
out->i_length = 0; out->i_length = 0;
...@@ -1352,7 +1338,6 @@ static int rtp_packetize_spx( sout_stream_id_sys_t *id, block_t *in ) ...@@ -1352,7 +1338,6 @@ static int rtp_packetize_spx( sout_stream_id_sys_t *id, block_t *in )
/* Copy the Speex payload to the p_output buffer */ /* Copy the Speex payload to the p_output buffer */
memcpy( &p_out->p_buffer[12], p_buffer, i_data_size ); memcpy( &p_out->p_buffer[12], p_buffer, i_data_size );
p_out->i_buffer = 12 + i_payload_size;
p_out->i_dts = in->i_dts; p_out->i_dts = in->i_dts;
p_out->i_length = in->i_length; p_out->i_length = in->i_length;
block_Release(in); block_Release(in);
...@@ -1382,7 +1367,6 @@ static int rtp_packetize_g726( sout_stream_id_sys_t *id, block_t *in, int i_pad ...@@ -1382,7 +1367,6 @@ static int rtp_packetize_g726( sout_stream_id_sys_t *id, block_t *in, int i_pad
memcpy( &out->p_buffer[12], p_data, i_payload ); memcpy( &out->p_buffer[12], p_data, i_payload );
out->i_buffer = 12 + i_payload;
out->i_dts = in->i_dts + i_packet++ * in->i_length / i_count; out->i_dts = in->i_dts + i_packet++ * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -1455,7 +1439,6 @@ static int rtp_packetize_vp8( sout_stream_id_sys_t *id, block_t *in ) ...@@ -1455,7 +1439,6 @@ static int rtp_packetize_vp8( sout_stream_id_sys_t *id, block_t *in )
(in->i_pts > VLC_TS_INVALID ? in->i_pts : in->i_dts) ); (in->i_pts > VLC_TS_INVALID ? in->i_pts : in->i_dts) );
memcpy( &out->p_buffer[RTP_VP8_PAYLOAD_START], p_data, i_payload ); memcpy( &out->p_buffer[RTP_VP8_PAYLOAD_START], p_data, i_payload );
out->i_buffer = RTP_VP8_PAYLOAD_START + i_payload;
out->i_dts = in->i_dts + i * in->i_length / i_count; out->i_dts = in->i_dts + i * in->i_length / i_count;
out->i_length = in->i_length / i_count; out->i_length = in->i_length / i_count;
...@@ -1638,7 +1621,6 @@ static int rtp_packetize_jpeg( sout_stream_id_sys_t *id, block_t *in ) ...@@ -1638,7 +1621,6 @@ static int rtp_packetize_jpeg( sout_stream_id_sys_t *id, block_t *in )
(in->i_pts > VLC_TS_INVALID ? in->i_pts : in->i_dts) ); (in->i_pts > VLC_TS_INVALID ? in->i_pts : in->i_dts) );
memcpy( p, p_data, i_payload ); memcpy( p, p_data, i_payload );
out->i_buffer = 12 + hdr_size + i_payload;
out->i_dts = in->i_dts; out->i_dts = in->i_dts;
out->i_length = in->i_length; out->i_length = in->i_length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment