[vlc-commits] demux: mp4: fix potential endless loop
Francois Cartegnie
git at videolan.org
Tue Aug 13 15:27:29 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Aug 13 15:20:42 2019 +0200| [5de914227402e7ed7653cc5700c1e6c155d2428b] | committer: Francois Cartegnie
demux: mp4: fix potential endless loop
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5de914227402e7ed7653cc5700c1e6c155d2428b
---
modules/demux/mp4/mp4.c | 8 +++++++-
modules/demux/mp4/mp4.h | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index d24c74cbac..a5afba1a0a 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -4551,6 +4551,10 @@ static int DemuxMoof( demux_t *p_demux )
if( p_sys->i_pcr == VLC_TICK_INVALID )
es_out_SetPCR( p_demux->out, VLC_TICK_0 + i_nztime );
+ /* Set per track read state */
+ for( unsigned i = 0; i < p_sys->i_tracks; i++ )
+ p_sys->track[i].context.i_temp = VLC_DEMUXER_SUCCESS;
+
/* demux up to increment amount of data on every track, or just set pcr if empty data */
for( ;; )
{
@@ -4564,7 +4568,8 @@ static int DemuxMoof( demux_t *p_demux )
if( !tk_tmp->b_ok || MP4_isMetadata( tk_tmp ) ||
(!tk_tmp->b_selected && !p_sys->b_seekable) ||
- tk_tmp->context.runs.i_current >= tk_tmp->context.runs.i_count )
+ tk_tmp->context.runs.i_current >= tk_tmp->context.runs.i_count ||
+ tk_tmp->context.i_temp != VLC_DEMUXER_SUCCESS )
continue;
/* At least still have data to demux on this or next turns */
@@ -4603,6 +4608,7 @@ static int DemuxMoof( demux_t *p_demux )
int i_ret = FragDemuxTrack( p_demux, tk, i_max_preload );
+ tk->context.i_temp = i_ret;
if( i_ret == VLC_DEMUXER_SUCCESS )
i_status = VLC_DEMUXER_SUCCESS;
else if( i_ret == VLC_DEMUXER_FATAL )
diff --git a/modules/demux/mp4/mp4.h b/modules/demux/mp4/mp4.h
index 21ab96f61c..688d429495 100644
--- a/modules/demux/mp4/mp4.h
+++ b/modules/demux/mp4/mp4.h
@@ -166,6 +166,7 @@ typedef struct
uint64_t i_trun_sample;
uint64_t i_trun_sample_pos;
+ int i_temp;
} context;
/* ASF packets handling */
More information about the vlc-commits
mailing list