[vlc-commits] [Git][videolan/vlc][3.0.x] demux: mp4: fix duration probing on missing info

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Tue Aug 15 08:57:19 UTC 2023



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
90d44efb by Francois Cartegnie at 2023-08-12T21:57:59+02:00
demux: mp4: fix duration probing on missing info

(cherry picked from commit 2ce189cc177f1b7ae923c9a40ea0c4c1660c9d9c)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

- - - - -


3 changed files:

- modules/demux/mp4/fragments.c
- modules/demux/mp4/fragments.h
- modules/demux/mp4/mp4.c


Changes:

=====================================
modules/demux/mp4/fragments.c
=====================================
@@ -66,9 +66,9 @@ stime_t MP4_Fragment_Index_GetTrackStartTime( mp4_fragments_index_t *p_index,
     return 0;
 }
 
-stime_t MP4_Fragment_Index_GetTrackDuration( mp4_fragments_index_t *p_index, unsigned i )
+stime_t MP4_Fragment_Index_GetTracksDuration( const mp4_fragments_index_t *p_index )
 {
-    return p_index->p_times[(size_t)(p_index->i_entries - 1) * p_index->i_tracks + i];
+    return p_index->i_last_time;
 }
 
 bool MP4_Fragments_Index_Lookup( mp4_fragments_index_t *p_index, stime_t *pi_time,


=====================================
modules/demux/mp4/fragments.h
=====================================
@@ -37,7 +37,7 @@ mp4_fragments_index_t * MP4_Fragments_Index_New( unsigned i_tracks, unsigned i_n
 
 stime_t MP4_Fragment_Index_GetTrackStartTime( mp4_fragments_index_t *p_index,
                                               unsigned i_track_index, uint64_t i_moof_pos );
-stime_t MP4_Fragment_Index_GetTrackDuration( mp4_fragments_index_t *p_index, unsigned i_track_index );
+stime_t MP4_Fragment_Index_GetTracksDuration( const mp4_fragments_index_t *p_index );
 
 bool MP4_Fragments_Index_Lookup( mp4_fragments_index_t *p_index,
                                  stime_t *pi_time, uint64_t *pi_pos, unsigned i_track_index );


=====================================
modules/demux/mp4/mp4.c
=====================================
@@ -4025,7 +4025,6 @@ static stime_t GetCumulatedDuration( demux_t *p_demux )
 
     for ( unsigned int i=0; i<p_sys->i_tracks; i++ )
     {
-        stime_t i_track_duration = 0;
         MP4_Box_t *p_trak = MP4_GetTrakByTrackID( p_sys->p_moov, p_sys->track[i].i_track_ID );
         const MP4_Box_t *p_stsz;
         const MP4_Box_t *p_tkhd;
@@ -4036,13 +4035,11 @@ static stime_t GetCumulatedDuration( demux_t *p_demux )
         {
             i_max_duration = __MAX( (uint64_t)i_max_duration, BOXDATA(p_tkhd)->i_duration );
         }
-
-        if( p_sys->p_fragsindex )
-        {
-            i_track_duration += MP4_Fragment_Index_GetTrackDuration( p_sys->p_fragsindex, i );
-        }
-
-        i_max_duration = __MAX( i_max_duration, i_track_duration );
+    }
+    if( p_sys->p_fragsindex )
+    {
+        stime_t i_tracks_duration = MP4_Fragment_Index_GetTracksDuration( p_sys->p_fragsindex );
+        i_max_duration = __MAX( i_max_duration, i_tracks_duration );
     }
 
     return i_max_duration;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/90d44efbc53dcfc307780bebee34d979c9a3a37a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/90d44efbc53dcfc307780bebee34d979c9a3a37a
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list