Commit 16c7b832 authored by Christophe Massiot's avatar Christophe Massiot

* demux.c: Do not send erroneous packets to the PSI decoder (anyway we'll get...

* demux.c: Do not send erroneous packets to the PSI decoder (anyway we'll get a CRC error, better to just reset the state-. * demux.c: Fix a major bug when handling a TS with a section begginning in the middle of the packet.
parent 8474daec
...@@ -213,14 +213,14 @@ static void demux_Handle( block_t *p_ts ) ...@@ -213,14 +213,14 @@ static void demux_Handle( block_t *p_ts )
dvb_Reset(); dvb_Reset();
} }
if ( !ts_get_transporterror( p_ts->p_ts ) )
{
/* PSI parsing */ /* PSI parsing */
if ( i_pid == TDT_PID || i_pid == RST_PID ) if ( i_pid == TDT_PID || i_pid == RST_PID )
SendTDT( p_ts ); SendTDT( p_ts );
else if ( p_pids[i_pid].i_psi_refcount ) else if ( p_pids[i_pid].i_psi_refcount )
HandlePSIPacket( p_ts->p_ts, p_ts->i_dts ); HandlePSIPacket( p_ts->p_ts, p_ts->i_dts );
p_pids[i_pid].i_last_cc = i_cc;
/* PCR handling */ /* PCR handling */
if ( ts_has_adaptation( p_ts->p_ts ) if ( ts_has_adaptation( p_ts->p_ts )
&& ts_get_adaptation( p_ts->p_ts ) && ts_get_adaptation( p_ts->p_ts )
...@@ -247,6 +247,9 @@ static void demux_Handle( block_t *p_ts ) ...@@ -247,6 +247,9 @@ static void demux_Handle( block_t *p_ts )
} }
} }
} }
}
p_pids[i_pid].i_last_cc = i_cc;
/* Output */ /* Output */
for ( i = 0; i < p_pids[i_pid].i_nb_outputs; i++ ) for ( i = 0; i < p_pids[i_pid].i_nb_outputs; i++ )
...@@ -2041,7 +2044,7 @@ static void HandlePSIPacket( uint8_t *p_ts, mtime_t i_dts ) ...@@ -2041,7 +2044,7 @@ static void HandlePSIPacket( uint8_t *p_ts, mtime_t i_dts )
uint16_t i_pid = ts_get_pid( p_ts ); uint16_t i_pid = ts_get_pid( p_ts );
ts_pid_t *p_pid = &p_pids[i_pid]; ts_pid_t *p_pid = &p_pids[i_pid];
uint8_t i_cc = ts_get_cc( p_ts ); uint8_t i_cc = ts_get_cc( p_ts );
const uint8_t *p_payload = ts_payload( p_ts ); const uint8_t *p_payload;
uint8_t i_length; uint8_t i_length;
if ( ts_check_duplicate( i_cc, p_pid->i_last_cc ) if ( ts_check_duplicate( i_cc, p_pid->i_last_cc )
...@@ -2052,9 +2055,20 @@ static void HandlePSIPacket( uint8_t *p_ts, mtime_t i_dts ) ...@@ -2052,9 +2055,20 @@ static void HandlePSIPacket( uint8_t *p_ts, mtime_t i_dts )
&& ts_check_discontinuity( i_cc, p_pid->i_last_cc ) ) && ts_check_discontinuity( i_cc, p_pid->i_last_cc ) )
psi_assemble_reset( &p_pid->p_psi_buffer, &p_pid->i_psi_buffer_used ); psi_assemble_reset( &p_pid->p_psi_buffer, &p_pid->i_psi_buffer_used );
if ( psi_assemble_empty( &p_pid->p_psi_buffer, &p_pid->i_psi_buffer_used ) )
p_payload = ts_section( p_ts ); p_payload = ts_section( p_ts );
i_length = p_ts + TS_SIZE - p_payload;
if ( !psi_assemble_empty( &p_pid->p_psi_buffer,
&p_pid->i_psi_buffer_used ) )
{
uint8_t *p_section = psi_assemble_payload( &p_pid->p_psi_buffer,
&p_pid->i_psi_buffer_used,
&p_payload, &i_length );
if ( p_section != NULL )
HandleSection( i_pid, p_section, i_dts );
}
p_payload = ts_next_section( p_ts );
i_length = p_ts + TS_SIZE - p_payload; i_length = p_ts + TS_SIZE - p_payload;
while ( i_length ) while ( i_length )
......
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