mkv: fixed SegmentSeeker::get_search_areas
authorFilip Roséen <filip@videolabs.io>
Sat, 21 May 2016 00:17:58 +0000 (02:17 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 23 May 2016 14:21:52 +0000 (16:21 +0200)
Fixed bug where a too big of an area would be returned from the
function, instead of just the area that is really not searched
(indexed).

This will, of course, speed up seeking since we will not rescan an area
where we already know everything there is to know.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/demux/mkv/matroska_segment_seeker.cpp

index 8ae1a4a..a9ad735 100644 (file)
@@ -366,9 +366,11 @@ SegmentSeeker::get_search_areas( fptr_t start, fptr_t end ) const
             areas_to_search.push_back( Range( needle.start, it->start ) );
         }
 
-        needle.start = it->end + 1;
+        if( needle.start <= it->end )
+            needle.start = it->end + 1;
     }
 
+    needle.start = std::max( needle.start, start );
     if( it == _ranges_searched.end() && needle.start < needle.end )
     {
         areas_to_search.push_back( needle );