[vlc-devel] [PATCH] MKV: don't update the playback PTS from unused tracks

Steve Lhomme robUx4 at videolabs.io
Mon Mar 2 12:02:37 CET 2015


Fixes #11847

This file has bad interleaving and shows the progress of broken tracks that are not in use.
With this patch we only show the progress for the track(s) in use
---
 modules/demux/mkv/mkv.cpp | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 7b8abb1..82bdd7f 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -771,10 +771,32 @@ static int Demux( demux_t *p_demux)
             }
         }
 
+        unsigned int i_track_number;
         if( simpleblock != NULL )
-            p_sys->i_pts = p_sys->i_chapter_time + ( (mtime_t)simpleblock->GlobalTimecode() / INT64_C(1000) );
+            i_track_number = simpleblock->TrackNum();
         else
-            p_sys->i_pts = p_sys->i_chapter_time + ( (mtime_t)block->GlobalTimecode() / INT64_C(1000) );
+            i_track_number = block->TrackNum();
+
+        bool b_active = false;
+        virtual_segment_c  *p_vsegment = p_sys->p_current_segment;
+        matroska_segment_c *p_old = p_vsegment->CurrentSegment();
+        for( size_t i = 0; i < p_old->tracks.size(); i++)
+        {
+            mkv_track_t *p_tk = p_old->tracks[i];
+            if ( p_tk->p_es && p_tk->i_number == i_track_number )
+            {
+                es_out_Control( p_old->sys.demuxer.out, ES_OUT_GET_ES_STATE, p_tk->p_es, &b_active );
+                break;
+            }
+        }
+
+        if ( b_active )
+        {
+            if( simpleblock != NULL )
+                p_sys->i_pts = p_sys->i_chapter_time + ( (mtime_t)simpleblock->GlobalTimecode() / INT64_C(1000) );
+            else
+                p_sys->i_pts = p_sys->i_chapter_time + ( (mtime_t)block->GlobalTimecode() / INT64_C(1000) );
+        }
 
         mtime_t i_pcr = VLC_TS_INVALID;
         for( size_t i = 0; i < p_segment->tracks.size(); i++)
-- 
2.2.2




More information about the vlc-devel mailing list