[vlc-commits] demux: mp4: don't use mvhd duration for seek

Francois Cartegnie git at videolan.org
Wed May 3 14:54:29 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May  2 15:46:09 2017 +0200| [b32c50d99089de33bf71ce61554ef671f6e3a8ef] | committer: Francois Cartegnie

demux: mp4: don't use mvhd duration for seek

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b32c50d99089de33bf71ce61554ef671f6e3a8ef
---

 modules/demux/mp4/mp4.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 852659176a..9388263cb1 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -1523,16 +1523,17 @@ static int LeafSeekToTime( demux_t *p_demux, mtime_t i_nztime )
         p_sys->b_index_probed = true;
     }
 
-    if( (uint64_t)MP4_rescale( i_nztime, CLOCK_FREQ, p_sys->i_timescale ) < p_sys->i_moov_duration )
+    const unsigned i_seek_track_index = GetSeekTrackIndex( p_sys );
+    const unsigned i_seek_track_ID = p_sys->track[i_seek_track_index].i_track_ID;
+
+    if( MP4_rescale( i_nztime, CLOCK_FREQ, p_sys->track[i_seek_track_index].i_timescale ) <
+                     GetMoovTrackDuration( p_sys, i_seek_track_ID ) )
     {
         i64 = p_sys->p_moov->i_pos;
         i_segment_type = ATOM_moov;
     }
     else
     {
-        const unsigned i_seek_track_index = GetSeekTrackIndex( p_sys );
-        const unsigned i_seek_track_ID = p_sys->track[i_seek_track_index].i_track_ID;
-
         bool b_buildindex = false;
         mtime_t i_sync_time = i_nztime;
         if( LeafGetMoofByTfraIndex( p_demux, i_nztime, i_seek_track_ID, &i64, &i_sync_time ) == VLC_SUCCESS )



More information about the vlc-commits mailing list