[vlc-commits] demux: ts: use last pointer for prepcr queue
Francois Cartegnie
git at videolan.org
Thu Dec 8 12:23:52 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 8 12:18:49 2016 +0100| [1a0dc5b0aa470230c654514b224104b50e734b25] | committer: Francois Cartegnie
demux: ts: use last pointer for prepcr queue
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a0dc5b0aa470230c654514b224104b50e734b25
---
modules/demux/mpeg/ts.c | 22 ++++++++++++----------
modules/demux/mpeg/ts_streams.c | 7 ++++---
modules/demux/mpeg/ts_streams_private.h | 6 +++++-
3 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 7fc4917..d6cfc10 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -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;
diff --git a/modules/demux/mpeg/ts_streams.c b/modules/demux/mpeg/ts_streams.c
index 862dc9f..6ee5230 100644
--- a/modules/demux/mpeg/ts_streams.c
+++ b/modules/demux/mpeg/ts_streams.c
@@ -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 );
}
diff --git a/modules/demux/mpeg/ts_streams_private.h b/modules/demux/mpeg/ts_streams_private.h
index 16149da..b39d743 100644
--- a/modules/demux/mpeg/ts_streams_private.h
+++ b/modules/demux/mpeg/ts_streams_private.h
@@ -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
More information about the vlc-commits
mailing list