[vlc-commits] demux: mp4: return smallest moov duration as track duration

Francois Cartegnie git at videolan.org
Mon Apr 30 17:32:19 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Apr 30 16:46:14 2018 +0200| [7c7ff1805a9515cd6253027239b93e1eddaf9a75] | committer: Francois Cartegnie

demux: mp4: return smallest moov duration as track duration

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

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

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 186d5f0864..51bd32ea2d 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -4134,7 +4134,10 @@ static stime_t GetMoovTrackDuration( demux_sys_t *p_sys, unsigned i_track_ID )
          /* duration might be wrong an be set to whole duration :/ */
          BOXDATA(p_stsz)->i_sample_count > 0 )
     {
-        return BOXDATA(p_tkhd)->i_duration; /* In movie / mvhd scale */
+        if( BOXDATA(p_tkhd)->i_duration <= p_sys->i_moov_duration )
+            return BOXDATA(p_tkhd)->i_duration; /* In movie / mvhd scale */
+        else
+            return p_sys->i_moov_duration;
     }
     return 0;
 }



More information about the vlc-commits mailing list