[vlc-devel] [PATCH] mkv: fix playback/seek for files where first block has PTS > 0

Filip Roséen filip at videolabs.io
Thu May 26 13:35:55 CEST 2016


Some files do not have their first cluster at PTS=0, meaning that we
might spend an eternity looking for such PTS (even though it is not at
all present in the file) when starting playback (seeking to 0).

This patch fixes the issue by always assigning a seekpoint for PTS=0 pointing
at the first cluster position. Instead of using the cluster-timecode, a
hardcoded value of 0 is used (so that every file will have a seekpoint at that
location).

---
 modules/demux/mkv/matroska_segment.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 4f57957..18fdb8b 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -641,12 +641,8 @@ bool matroska_segment_c::Preload( )
             // add first cluster as trusted seekpoint for all tracks
             for( tracks_map_t::iterator it = tracks.begin(); it != tracks.end(); ++it )
             {
-                _seeker.add_seekpoint(
-                  it->first,
-                  SegmentSeeker::Seekpoint::TRUSTED,
-                  cluster->GetElementPosition(),
-                  cluster->GlobalTimecode() / 1000
-                );
+                _seeker.add_seekpoint( it->first, SegmentSeeker::Seekpoint::TRUSTED,
+                  cluster->GetElementPosition(), 0 );
             }
 
             ep->Down();
-- 
2.8.2



More information about the vlc-devel mailing list