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

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Feb 17 10:50:42 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
2ce189cc by Francois Cartegnie at 2023-02-17T10:15:11+00:00
demux: mp4: fix duration probing on missing info

- - - - -


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
=====================================
@@ -4290,7 +4290,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;
@@ -4301,13 +4300,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/2ce189cc177f1b7ae923c9a40ea0c4c1660c9d9c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2ce189cc177f1b7ae923c9a40ea0c4c1660c9d9c
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