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 ) ...@@ -510,6 +510,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_pmtslots = p_sys->b_sdt = 0; p_sys->i_pmtslots = p_sys->b_sdt = 0;
p_sys->i_num_pmt = 1; p_sys->i_num_pmt = 1;
p_sys->dvbpmt = NULL; p_sys->dvbpmt = NULL;
memset( &p_sys->pmtmap, 0, sizeof(p_sys->pmtmap) ); memset( &p_sys->pmtmap, 0, sizeof(p_sys->pmtmap) );
vlc_mutex_init( &p_sys->csa_lock ); vlc_mutex_init( &p_sys->csa_lock );
...@@ -1511,12 +1512,12 @@ static int Mux( sout_mux_t *p_mux ) ...@@ -1511,12 +1512,12 @@ static int Mux( sout_mux_t *p_mux )
p_data->i_length = 1000; p_data->i_length = 1000;
if( ( p_pcr_stream->i_pes_dts > 0 && 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_pcr_stream->i_pes_length ) ||
p_data->i_dts < p_stream->i_pes_dts || p_data->i_dts < p_stream->i_pes_dts ||
( p_stream->i_pes_dts > 0 && ( p_stream->i_pes_dts > 0 &&
p_input->p_fmt->i_cat != SPU_ES && 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 ) ) p_stream->i_pes_length ) )
{ {
msg_Warn( p_mux, "packet with too strange dts " msg_Warn( p_mux, "packet with too strange dts "
...@@ -1769,6 +1770,8 @@ static block_t *FixPES( sout_mux_t *p_mux, block_fifo_t *p_fifo ) ...@@ -1769,6 +1770,8 @@ static block_t *FixPES( sout_mux_t *p_mux, block_fifo_t *p_fifo )
block_t *p_data; block_t *p_data;
size_t i_size; size_t i_size;
VLC_UNUSED(p_mux);
p_data = block_FifoShow( p_fifo ); p_data = block_FifoShow( p_fifo );
i_size = p_data->i_buffer; 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, ...@@ -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_packet_count = p_chain_ts->i_depth;
int i; 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) int i_bitrate = ((uint64_t)i_packet_count * 188 * 8000)
/ (uint64_t)(i_pcr_length / 1000); / (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, ...@@ -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 msg_Warn( p_mux, "max bitrate exceeded at %"PRId64
" (%d bi/s for %d pkt in %"PRId64" us)", " (%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); i_bitrate, i_packet_count, i_pcr_length);
} }
#if 0 #if 0
...@@ -1995,7 +1998,7 @@ static void TSDate( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts, ...@@ -1995,7 +1998,7 @@ static void TSDate( sout_mux_t *p_mux, sout_buffer_chain_t *p_chain_ts,
} }
/* latency */ /* 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 ); 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, ...@@ -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_max = 184 - ( b_pcr ? 8 : 0 );
int i_payload; int i_payload;
VLC_UNUSED(p_mux);
if( p_stream->i_pes_used <= 0 ) if( p_stream->i_pes_used <= 0 )
{ {
b_new_pes = true; b_new_pes = true;
...@@ -2227,6 +2232,8 @@ static void PEStoTS( sout_instance_t *p_sout, ...@@ -2227,6 +2232,8 @@ static void PEStoTS( sout_instance_t *p_sout,
int i_size; int i_size;
int b_new_pes; int b_new_pes;
VLC_UNUSED(p_sout);
/* get PES total size */ /* get PES total size */
i_size = p_pes->i_buffer; i_size = p_pes->i_buffer;
p_data = p_pes->p_buffer; p_data = p_pes->p_buffer;
...@@ -2315,6 +2322,7 @@ static block_t *WritePSISection( sout_instance_t *p_sout, ...@@ -2315,6 +2322,7 @@ static block_t *WritePSISection( sout_instance_t *p_sout,
dvbpsi_psi_section_t* p_section ) dvbpsi_psi_section_t* p_section )
{ {
block_t *p_psi, *p_first = NULL; block_t *p_psi, *p_first = NULL;
VLC_UNUSED(p_sout);
while( p_section ) 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