[vlc-commits] demux: mkv: avoid pre-reading data for the index if we have a matching index

Steve Lhomme git at videolan.org
Mon Oct 5 08:39:27 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct  2 12:48:59 2020 +0200| [4549232d0de43a3b203d3d10d9bd3f905f3d7b93] | committer: Steve Lhomme

demux: mkv: avoid pre-reading data for the index if we have a matching index

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4549232d0de43a3b203d3d10d9bd3f905f3d7b93
---

 modules/demux/mkv/matroska_segment_seeker.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mkv/matroska_segment_seeker.cpp b/modules/demux/mkv/matroska_segment_seeker.cpp
index d4b3d8e3a7..bdacc4e73d 100644
--- a/modules/demux/mkv/matroska_segment_seeker.cpp
+++ b/modules/demux/mkv/matroska_segment_seeker.cpp
@@ -318,8 +318,10 @@ SegmentSeeker::get_seekpoints( matroska_segment_c& ms, vlc_tick_t target_pts,
         if ( start.fpos == std::numeric_limits<fptr_t>::max() )
             return tracks_seekpoint_t();
 
-        if ( end.fpos != std::numeric_limits<fptr_t>::max() || !ms.b_cues )
+        if ( (end.fpos != std::numeric_limits<fptr_t>::max() || !ms.b_cues) &&
+             (needle_pts != start.pts || start.trust_level < Seekpoint::TRUSTED))
             // do not read the whole (infinite?) file to get seek indexes
+            // do not generate an index if we already have the correct seekpoint
             index_range( ms, Range( start.fpos, end.fpos ), needle_pts );
 
         tracks_seekpoint_t tpoints = find_greatest_seekpoints_in_range( start.fpos, target_pts, filter_tracks );



More information about the vlc-commits mailing list