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

Try to make 20ms packets for L8 and G.711

(rather than as big packets as possible)
parent 037b7ad2
...@@ -1827,16 +1827,14 @@ static int rtp_packetize_l16( sout_stream_t *p_stream, sout_stream_id_t *id, ...@@ -1827,16 +1827,14 @@ static int rtp_packetize_l16( sout_stream_t *p_stream, sout_stream_id_t *id,
static int rtp_packetize_l8( sout_stream_t *p_stream, sout_stream_id_t *id, static int rtp_packetize_l8( sout_stream_t *p_stream, sout_stream_id_t *id,
block_t *in ) block_t *in )
{ {
int i_max = id->i_mtu - 12; /* payload max in one packet */ /* ptime=20ms */
int i_count = ( in->i_buffer + i_max - 1 ) / i_max; size_t i_plen = id->i_channels * ( ( id->i_clock_rate + 49 ) / 50 );
uint8_t *p_data = in->p_buffer; uint8_t *p_data = in->p_buffer;
int i_data = in->i_buffer; size_t i_data = in->i_buffer;
int i_packet = 0;
while( i_data > 0 ) for( unsigned i_packet = 0; i_data > 0; i_packet++ )
{ {
int i_payload = (__MIN( i_max, i_data )/2)*2; int i_payload = __MIN( i_plen, i_data );
block_t *out = block_New( p_stream, 12 + i_payload ); block_t *out = block_New( p_stream, 12 + i_payload );
/* rtp common header */ /* rtp common header */
...@@ -1845,14 +1843,13 @@ static int rtp_packetize_l8( sout_stream_t *p_stream, sout_stream_id_t *id, ...@@ -1845,14 +1843,13 @@ static int rtp_packetize_l8( sout_stream_t *p_stream, sout_stream_id_t *id,
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_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 * 20000;
out->i_length = in->i_length / i_count; out->i_length = i_payload * 20000 / i_plen;
rtp_packetize_send( id, out ); rtp_packetize_send( id, out );
p_data += i_payload; p_data += i_payload;
i_data -= i_payload; i_data -= i_payload;
i_packet++;
} }
return VLC_SUCCESS; return VLC_SUCCESS;
......
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