[vlc-commits] demux: mp4: do not store non seekable fragments
Francois Cartegnie
git at videolan.org
Sat Jul 16 21:48:22 CEST 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jul 16 21:46:09 2016 +0200| [f95fda914c01935535cf0d2f58353e452ca85b56] | committer: Francois Cartegnie
demux: mp4: do not store non seekable fragments
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f95fda914c01935535cf0d2f58353e452ca85b56
---
modules/demux/mp4/fragments.c | 16 ++++++++++++++++
modules/demux/mp4/fragments.h | 1 +
modules/demux/mp4/mp4.c | 5 +++++
3 files changed, 22 insertions(+)
diff --git a/modules/demux/mp4/fragments.c b/modules/demux/mp4/fragments.c
index d9d460a..a446e91 100644
--- a/modules/demux/mp4/fragments.c
+++ b/modules/demux/mp4/fragments.c
@@ -45,6 +45,22 @@ void MP4_Fragment_Clean( mp4_fragment_t *p_fragment )
free( p_fragment->p_durations );
}
+void MP4_Fragments_Remove( mp4_fragments_t *p_frags, mp4_fragment_t *p_fragment )
+{
+ mp4_fragment_t *p_current = &p_frags->moov;
+ while( p_current )
+ {
+ if( p_fragment == p_current->p_next )
+ {
+ p_current->p_next = p_fragment->p_next;
+ p_fragment->p_next = NULL;
+ if( p_frags->p_last == p_fragment )
+ p_frags->p_last = p_current;
+ return;
+ }
+ }
+}
+
void MP4_Fragments_Clean( mp4_fragments_t *p_frags )
{
while( p_frags->moov.p_next )
diff --git a/modules/demux/mp4/fragments.h b/modules/demux/mp4/fragments.h
index b8ec4ff..9b2a3b0 100644
--- a/modules/demux/mp4/fragments.h
+++ b/modules/demux/mp4/fragments.h
@@ -65,6 +65,7 @@ static inline void MP4_Fragment_Delete( mp4_fragment_t *p_fragment )
bool MP4_Fragments_Init(mp4_fragments_t *);
void MP4_Fragments_Clean(mp4_fragments_t *);
void MP4_Fragments_Insert(mp4_fragments_t *, mp4_fragment_t *);
+void MP4_Fragments_Remove( mp4_fragments_t *, mp4_fragment_t * );
stime_t GetTrackTotalDuration( mp4_fragments_t *p_frags, unsigned int i_track_ID );
mp4_fragment_t * GetFragmentByAtomPos( mp4_fragments_t *p_frags, uint64_t i_pos );
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index a2e312d..9cbd55a 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -5107,6 +5107,11 @@ static int DemuxAsLeaf( demux_t *p_demux )
}
else
{
+ if( p_sys->context.p_fragment && !p_sys->b_seekable )
+ {
+ MP4_Fragments_Remove( &p_sys->fragments, p_sys->context.p_fragment );
+ MP4_Fragment_Delete( p_sys->context.p_fragment );
+ }
/* skip mdat header */
p_sys->context.p_fragment = GetFragmentByPos( &p_sys->fragments, stream_Tell( p_demux->s ) + 8, true );
}
More information about the vlc-commits
mailing list