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

mux ts: small fixes and optimizations

Fixes:
- compiler warnings on unused variables
- comparing correct types
- optimized calculations
parent 55334eea
......@@ -510,6 +510,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_pmtslots = p_sys->b_sdt = 0;
p_sys->i_num_pmt = 1;
p_sys->dvbpmt = NULL;
memset( &p_sys->pmtmap, 0, sizeof(p_sys->pmtmap) );
vlc_mutex_init( &p_sys->csa_lock );
......@@ -1511,12 +1512,12 @@ static int Mux( sout_mux_t *p_mux )
p_data->i_length = 1000;
if( ( p_pcr_stream->i_pes_dts > 0 &&
p_data->i_dts - 10000000 > p_pcr_stream->i_pes_dts +
p_data->i_dts - (mtime_t)10000000 > p_pcr_stream->i_pes_dts +
p_pcr_stream->i_pes_length ) ||
p_data->i_dts < p_stream->i_pes_dts ||
( p_stream->i_pes_dts > 0 &&
p_input->p_fmt->i_cat != SPU_ES &&
p_data->i_dts - 10000000 > p_stream->i_pes_dts +
p_data->i_dts - (mtime_t)10000000 > p_stream->i_pes_dts +
p_stream->i_pes_length ) )
{
msg_Warn( p_mux, "packet with too strange dts "
......@@ -1630,7 +1631,7 @@ static int Mux( sout_mux_t *p_mux )
i_max_pes_size = INT_MAX;
}
EStoPES ( p_mux->p_sout, &p_data, p_data,
EStoPES ( p_mux->p_sout, &p_data, p_data,
p_input->p_fmt, p_stream->i_stream_id,
1, b_data_alignment, i_header_size,
i_max_pes_size );
......@@ -1769,6 +1770,8 @@ static block_t *FixPES( sout_mux_t *p_mux, block_fifo_t *p_fifo )
block_t *p_data;
size_t i_size;
VLC_UNUSED(p_mux);
p_data = block_FifoShow( p_fifo );
i_size = p_data->i_buffer;
......@@ -1945,7 +1948,7 @@ static void TSDate( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts,
int i_packet_count = p_chain_ts->i_depth;
int i;
if ( i_pcr_length / 1000 > 0 )
if ( i_pcr_length >= 1000 ) /* i_pcr_length / 1000 > 0 */
{
int i_bitrate = ((uint64_t)i_packet_count * 188 * 8000)
/ (uint64_t)(i_pcr_length / 1000);
......@@ -1953,7 +1956,7 @@ static void TSDate( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts,
{
msg_Warn( p_mux, "max bitrate exceeded at %"PRId64
" (%d bi/s for %d pkt in %"PRId64" us)",
i_pcr_dts + p_sys->i_shaping_delay * 3 / 2 - mdate(),
i_pcr_dts + ((p_sys->i_shaping_delay * 3) >> 1) - mdate(),
i_bitrate, i_packet_count, i_pcr_length);
}
#if 0
......@@ -1995,7 +1998,7 @@ static void TSDate( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts,
}
/* latency */
p_ts->i_dts += p_sys->i_shaping_delay * 3 / 2;
p_ts->i_dts += (p_sys->i_shaping_delay * 3) >> 1;
sout_AccessOutWrite( p_mux->p_access, p_ts );
}
......@@ -2013,6 +2016,8 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
int i_payload_max = 184 - ( b_pcr ? 8 : 0 );
int i_payload;
VLC_UNUSED(p_mux);
if( p_stream->i_pes_used <= 0 )
{
b_new_pes = true;
......@@ -2227,6 +2232,8 @@ static void PEStoTS( sout_instance_t *p_sout,
int i_size;
int b_new_pes;
VLC_UNUSED(p_sout);
/* get PES total size */
i_size = p_pes->i_buffer;
p_data = p_pes->p_buffer;
......@@ -2315,6 +2322,7 @@ static block_t *WritePSISection( sout_instance_t *p_sout,
dvbpsi_psi_section_t* p_section )
{
block_t *p_psi, *p_first = NULL;
VLC_UNUSED(p_sout);
while( p_section )
{
......
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