Commit 089fb216 authored by Rafaël Carré's avatar Rafaël Carré

TS Mux: cosmetics, deintend

parent 7406b9de
...@@ -1257,13 +1257,11 @@ static bool MuxStreams(sout_mux_t *p_mux ) ...@@ -1257,13 +1257,11 @@ static bool MuxStreams(sout_mux_t *p_mux )
block_t *p_data; block_t *p_data;
if( p_stream == p_pcr_stream || p_sys->b_data_alignment if( p_stream == p_pcr_stream || p_sys->b_data_alignment
|| p_input->p_fmt->i_codec != || p_input->p_fmt->i_codec != VLC_CODEC_MPGA )
VLC_CODEC_MPGA )
{ {
p_data = block_FifoGet( p_input->p_fifo ); p_data = block_FifoGet( p_input->p_fifo );
if( p_input->p_fmt->i_codec == if( p_input->p_fmt->i_codec == VLC_CODEC_MP4A )
VLC_CODEC_MP4A )
p_data = Add_ADTS( p_data, p_input->p_fmt ); p_data = Add_ADTS( p_data, p_input->p_fmt );
} }
else else
...@@ -1462,8 +1460,7 @@ static bool MuxStreams(sout_mux_t *p_mux ) ...@@ -1462,8 +1460,7 @@ static bool MuxStreams(sout_mux_t *p_mux )
continue; continue;
} }
if( i_stream == -1 || if( i_stream == -1 || p_stream->i_pes_dts < i_dts )
p_stream->i_pes_dts < i_dts )
{ {
i_stream = i; i_stream = i;
i_dts = p_stream->i_pes_dts; i_dts = p_stream->i_pes_dts;
...@@ -1666,39 +1663,35 @@ static void TSSchedule( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts, ...@@ -1666,39 +1663,35 @@ static void TSSchedule( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts,
BufferChainAppend( &new_chain, p_ts ); BufferChainAppend( &new_chain, p_ts );
if( p_ts->i_dts && if (!p_ts->i_dts || p_ts->i_dts + p_sys->i_dts_delay * 2/3 >= i_new_dts)
p_ts->i_dts + p_sys->i_dts_delay * 2/3 < i_new_dts ) continue;
mtime_t i_max_diff = i_new_dts - p_ts->i_dts;
mtime_t i_cut_dts = p_ts->i_dts;
p_ts = BufferChainPeek( p_chain_ts );
i++;
i_new_dts = i_pcr_dts + i_pcr_length * i / i_packet_count;
while ( p_ts != NULL && i_new_dts - p_ts->i_dts >= i_max_diff )
{ {
mtime_t i_max_diff = i_new_dts - p_ts->i_dts; p_ts = BufferChainGet( p_chain_ts );
mtime_t i_cut_dts = p_ts->i_dts; i_max_diff = i_new_dts - p_ts->i_dts;
i_cut_dts = p_ts->i_dts;
BufferChainAppend( &new_chain, p_ts );
p_ts = BufferChainPeek( p_chain_ts ); p_ts = BufferChainPeek( p_chain_ts );
i++; i++;
i_new_dts = i_pcr_dts + i_pcr_length * i / i_packet_count; i_new_dts = i_pcr_dts + i_pcr_length * i / i_packet_count;
while ( p_ts != NULL && i_new_dts - p_ts->i_dts >= i_max_diff )
{
p_ts = BufferChainGet( p_chain_ts );
i_max_diff = i_new_dts - p_ts->i_dts;
i_cut_dts = p_ts->i_dts;
BufferChainAppend( &new_chain, p_ts );
p_ts = BufferChainPeek( p_chain_ts );
i++;
i_new_dts = i_pcr_dts + i_pcr_length * i / i_packet_count;
}
msg_Dbg( p_mux, "adjusting rate at %"PRId64"/%"PRId64" (%d/%d)",
i_cut_dts - i_pcr_dts, i_pcr_length, new_chain.i_depth,
p_chain_ts->i_depth );
if ( new_chain.i_depth )
TSDate( p_mux, &new_chain,
i_cut_dts - i_pcr_dts,
i_pcr_dts );
if ( p_chain_ts->i_depth )
TSSchedule( p_mux,
p_chain_ts, i_pcr_dts + i_pcr_length - i_cut_dts,
i_cut_dts );
return;
} }
msg_Dbg( p_mux, "adjusting rate at %"PRId64"/%"PRId64" (%d/%d)",
i_cut_dts - i_pcr_dts, i_pcr_length, new_chain.i_depth,
p_chain_ts->i_depth );
if ( new_chain.i_depth )
TSDate( p_mux, &new_chain, i_cut_dts - i_pcr_dts, i_pcr_dts );
if ( p_chain_ts->i_depth )
TSSchedule( p_mux, p_chain_ts, i_pcr_dts + i_pcr_length - i_cut_dts,
i_cut_dts );
return;
} }
if ( new_chain.i_depth ) if ( new_chain.i_depth )
......
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