Commit a3e0b6ca authored by Jean-Paul Saman's avatar Jean-Paul Saman

modules/mux/mpeg/ts.c: Fix adaptation field length without splicing point.

The adaptation field size was not correct in the case that there was no splicing point. This
resulted in corrupt TS packets.
parent 23b13015
......@@ -2091,21 +2091,24 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
int i_stuffing = i_payload_max - i_payload;
int i_stuffing_start = b_splicing_point ? 7 : 6;
p_ts->p_buffer[4] = i_stuffing + (b_splicing_point ? 2 : 1);
p_ts->p_buffer[5] = 0x00;
if( b_splicing_point )
p_ts->p_buffer[4] = i_stuffing + (b_splicing_point ? 2 : -1);
if( i_stuffing > 1 )
{
p_ts->p_buffer[5] |= 0x04; /* flag splicing point */
/* in (+) or out (-) point */
p_ts->p_buffer[6] = p_stream->i_splice_countdown > 0 ?
(0x80 | (p_stream->i_splice_countdown & 0x7f)) : 0;
p_stream->b_splicing_point = !(p_stream->i_splice_countdown == 127);
p_stream->i_splice_countdown++;
}
p_ts->p_buffer[5] = 0x00;
if( b_splicing_point )
{
p_ts->p_buffer[5] |= 0x04; /* flag splicing point */
/* in (+) or out (-) point */
p_ts->p_buffer[6] = p_stream->i_splice_countdown > 0 ?
(0x80 | (p_stream->i_splice_countdown & 0x7f)) : 0;
p_stream->b_splicing_point = !(p_stream->i_splice_countdown == 127);
p_stream->i_splice_countdown++;
}
for( i = i_stuffing_start; i < i_stuffing_start + i_stuffing; i++ )
{
p_ts->p_buffer[i] = 0xff;
for( i = i_stuffing_start; i < i_stuffing_start + i_stuffing; i++ )
{
p_ts->p_buffer[i] = 0xff;
}
}
}
}
......
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