[vlc-devel] [PATCH 3/3] fixed the priority calculation. When mediatime is negative in elst it is empty edit. empty edits is used to shift the start time of the track by segment duration.

Rajneesh Soni soni.rajneesh at gmail.com
Wed Sep 20 07:47:11 CEST 2017


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

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 96ebc90..6d0edaf 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -3469,6 +3469,7 @@ static void MP4_TrackSetup( demux_t *p_demux, mp4_track_t *p_track,
     else if ( p_track->p_elst && p_track->fmt.i_priority == ES_PRIORITY_SELECTABLE_MIN )
     {
 #define MAX_SELECTABLE (INT_MAX - ES_PRIORITY_SELECTABLE_MIN)
+        int i_time = 0;
         for ( uint32_t i=0; i<p_track->BOXDATA(p_elst)->i_entry_count; i++ )
         {
             if ( p_track->BOXDATA(p_elst)->i_media_time[i] >= 0 &&
@@ -3476,10 +3477,14 @@ static void MP4_TrackSetup( demux_t *p_demux, mp4_track_t *p_track,
             {
                 /* We do selection by inverting start time into priority.
                    The track with earliest edit will have the highest prio */
-                const int i_time = __MIN( MAX_SELECTABLE, p_track->BOXDATA(p_elst)->i_media_time[i] );
+                i_time += __MIN( MAX_SELECTABLE, p_track->BOXDATA(p_elst)->i_media_time[i] );
                 p_track->fmt.i_priority = ES_PRIORITY_SELECTABLE_MIN + MAX_SELECTABLE - i_time;
                 break;
             }
+            else
+            {
+                i_time += p_track->BOXDATA(p_elst)->i_segment_duration[i];
+            }
         }
     }
 
-- 
2.7.4



More information about the vlc-devel mailing list