[vlc-devel] [PATCH 2/4] demux: mkv: avoid pre-reading data for the index if we have a matching index

Steve Lhomme robux4 at ycbcr.xyz
Fri Oct 2 13:19:36 CEST 2020


---
 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 d4b3d8e3a72..bdacc4e73d3 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 );
-- 
2.26.2



More information about the vlc-devel mailing list