Commit 1a0dc5b0 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: ts: use last pointer for prepcr queue

parent d75c0ce3
......@@ -1433,14 +1433,15 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
if( p_es->id && (p_pmt->pcr.i_current > -1 || p_pmt->pcr.b_disable) )
{
if( pid->u.p_pes->p_prepcr_outqueue )
if( pid->u.p_pes->prepcr.p_head )
{
/* Rebuild current output chain, appending any prepcr outqueue */
block_ChainAppend( &pid->u.p_pes->p_prepcr_outqueue, p_block );
block_ChainLastAppend( &pid->u.p_pes->prepcr.pp_last, p_block );
if( p_chain )
block_ChainAppend( &pid->u.p_pes->p_prepcr_outqueue, p_chain );
p_chain = pid->u.p_pes->p_prepcr_outqueue;
pid->u.p_pes->p_prepcr_outqueue = NULL;
block_ChainLastAppend( &pid->u.p_pes->prepcr.pp_last, p_chain );
p_chain = pid->u.p_pes->prepcr.p_head;
pid->u.p_pes->prepcr.p_head = NULL;
pid->u.p_pes->prepcr.pp_last = &pid->u.p_pes->prepcr.p_head;
/* Then now output all data */
continue;
}
......@@ -1571,7 +1572,7 @@ static void ParsePESDataChain( demux_t *p_demux, ts_pid_t *pid, block_t *p_pes )
if( !p_pmt->pcr.b_fix_done ) /* Not seen yet */
PCRFixHandle( p_demux, p_pmt, p_block );
block_ChainAppend( &pid->u.p_pes->p_prepcr_outqueue, p_block );
block_ChainLastAppend( &pid->u.p_pes->prepcr.pp_last, p_block );
}
}
}
......@@ -1797,10 +1798,11 @@ static void ReadyQueuesPostSeek( demux_t *p_demux )
pid->i_cc = 0xff;
if( pid->u.p_pes->p_prepcr_outqueue )
if( pid->u.p_pes->prepcr.p_head )
{
block_ChainRelease( pid->u.p_pes->p_prepcr_outqueue );
pid->u.p_pes->p_prepcr_outqueue = NULL;
block_ChainRelease( pid->u.p_pes->prepcr.p_head );
pid->u.p_pes->prepcr.p_head = NULL;
pid->u.p_pes->prepcr.pp_last = &pid->u.p_pes->prepcr.p_head;
}
ts_sections_processor_Reset( pid->u.p_pes->p_sections_proc );
......@@ -2087,7 +2089,7 @@ static void ProgramSetPCR( demux_t *p_demux, ts_pmt_t *p_pmt, mtime_t i_pcr )
for( int j=0; j<p_pmt->e_streams.i_size; j++ )
{
ts_pid_t *p_pid = p_pmt->e_streams.p_elems[j];
block_t *p_block = p_pid->u.p_pes->p_prepcr_outqueue;
block_t *p_block = p_pid->u.p_pes->prepcr.p_head;
while( p_block && p_block->i_dts == VLC_TS_INVALID )
p_block = p_block->p_next;
......
......@@ -281,7 +281,8 @@ ts_pes_t *ts_pes_New( demux_t *p_demux, ts_pmt_t *p_program )
pes->b_broken_PUSI_conformance = false;
pes->b_always_receive = false;
pes->p_sections_proc = NULL;
pes->p_prepcr_outqueue = NULL;
pes->prepcr.p_head = NULL;
pes->prepcr.pp_last = &pes->prepcr.p_head;
pes->sl.p_data = NULL;
pes->sl.pp_last = &pes->sl.p_data;
......@@ -298,8 +299,8 @@ void ts_pes_Del( demux_t *p_demux, ts_pes_t *pes )
if( pes->p_sections_proc )
ts_sections_processor_ChainDelete( pes->p_sections_proc );
if( pes->p_prepcr_outqueue )
block_ChainRelease( pes->p_prepcr_outqueue );
if( pes->prepcr.p_head )
block_ChainRelease( pes->prepcr.p_head );
free( pes );
}
......
......@@ -122,7 +122,11 @@ struct ts_pes_t
bool b_broken_PUSI_conformance;
ts_sections_processor_t *p_sections_proc;
block_t * p_prepcr_outqueue;
struct
{
block_t *p_head;
block_t **pp_last;
} prepcr;
/* SL AU */
struct
......
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