Commit f95fda91 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: mp4: do not store non seekable fragments

parent 995a12b2
......@@ -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 )
......
......@@ -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 );
......
......@@ -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 );
}
......
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