[vlc-commits] demux: mp4: always use sidx on discontinuity
Francois Cartegnie
git at videolan.org
Tue Jan 13 01:13:52 CET 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jan 13 01:12:37 2015 +0100| [5d66046d5621e1dbb722e8ace80239b1ab8f5a6a] | committer: Francois Cartegnie
demux: mp4: always use sidx on discontinuity
Should fix out-of-sync tracks with DASH
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d66046d5621e1dbb722e8ace80239b1ab8f5a6a
---
modules/demux/mp4/mp4.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 5ebdaa3..b3b6767 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -96,6 +96,7 @@ struct demux_sys_t
mp4_fragment_t *p_fragment;
uint32_t i_current_box_type;
uint32_t i_mdatbytesleft;
+ uint32_t i_lastseqnumber;
} context;
/* */
@@ -592,6 +593,8 @@ static int Open( vlc_object_t * p_this )
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
+ p_sys->context.i_lastseqnumber = 1;
+
p_demux->p_sys = p_sys;
if( stream_Peek( p_demux->s, &p_peek, 24 ) < 24 ) return VLC_EGENERIC;
@@ -5034,19 +5037,14 @@ static int DemuxAsLeaf( demux_t *p_demux )
return 1;
}
- if( p_sys->b_dash && p_sys->moovfragment.p_moox && p_sys->moovfragment.p_next )
+ MP4_Box_t *p_mfhd = MP4_BoxGet( p_fragbox, "mfhd" );
+ if( p_mfhd && BOXDATA(p_mfhd) )
{
/* Detect and Handle Passive Seek */
- mp4_fragment_t *lastfrag = p_sys->moovfragment.p_next;
- while(lastfrag->p_next)
- lastfrag = lastfrag->p_next;
- MP4_Box_t *p_mfhd = MP4_BoxGet( p_fragbox, "mfhd" );
- MP4_Box_t *p_prevmfhd = MP4_BoxGet( lastfrag->p_moox, "mfhd" );
- if( p_mfhd && p_prevmfhd &&
- BOXDATA(p_mfhd)->i_sequence_number != p_prevmfhd->data.p_mfhd->i_sequence_number + 1 )
+ if( p_sys->context.i_lastseqnumber + 1 != BOXDATA(p_mfhd)->i_sequence_number )
{
- msg_Info( p_demux, "Passive DASH Seek detected %"PRIu32" %"PRIu32,
- BOXDATA(p_mfhd)->i_sequence_number, p_prevmfhd->data.p_mfhd->i_sequence_number + 1 );
+ msg_Info( p_demux, "Fragment sequence discontinuity detected %"PRIu32" != %"PRIu32,
+ BOXDATA(p_mfhd)->i_sequence_number, p_sys->context.i_lastseqnumber + 1 );
MP4_Box_t *p_sidx = MP4_BoxGet( p_vroot, "sidx" );
if( p_sidx && BOXDATA(p_sidx) && BOXDATA(p_sidx)->i_timescale )
{
@@ -5062,6 +5060,7 @@ static int DemuxAsLeaf( demux_t *p_demux )
p_sys->i_pcr = VLC_TS_INVALID;
}
}
+ p_sys->context.i_lastseqnumber = BOXDATA(p_mfhd)->i_sequence_number;
}
/* detach */
More information about the vlc-commits
mailing list