[vlc-commits] demux:mkv: fix trying to seek before the first audio/video

Steve Lhomme git at videolan.org
Fri Jan 19 18:09:31 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 19 18:07:55 2018 +0100| [117bf6fea8eb81d6c8d2616f55cad51999efe44a] | committer: Steve Lhomme

demux:mkv: fix trying to seek before the first audio/video

We just seek to the first known Cluster.

Fixes #19286

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

 modules/demux/mkv/matroska_segment_seeker.cpp | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/modules/demux/mkv/matroska_segment_seeker.cpp b/modules/demux/mkv/matroska_segment_seeker.cpp
index 0e83e4e2c5..c8f62215f4 100644
--- a/modules/demux/mkv/matroska_segment_seeker.cpp
+++ b/modules/demux/mkv/matroska_segment_seeker.cpp
@@ -151,6 +151,23 @@ SegmentSeeker::find_greatest_seekpoints_in_range( fptr_t start_fpos, mtime_t end
         tpoints.insert( tracks_seekpoint_t::value_type( it->first, sp ) );
     }
 
+    if (tpoints.empty())
+    {
+        // try a further pts
+        for( tracks_seekpoints_t::const_iterator it = _tracks_seekpoints.begin(); it != _tracks_seekpoints.end(); ++it )
+        {
+            if ( std::find( filter_tracks.begin(), filter_tracks.end(), it->first ) == filter_tracks.end() )
+                continue;
+
+            Seekpoint sp = get_first_seekpoint_around( end_pts, it->second );
+
+            if( sp.fpos < start_fpos )
+                continue;
+
+            tpoints.insert( tracks_seekpoint_t::value_type( it->first, sp ) );
+        }
+    }
+
     return tpoints;
 }
 
@@ -198,6 +215,10 @@ SegmentSeeker::get_seekpoints_around( mtime_t pts, seekpoints_t const& seekpoint
     iterator const it_end    = seekpoints.end();
     iterator const it_middle = greatest_lower_bound( it_begin, it_end, needle );
 
+    if ( it_middle != it_end && (*it_middle).pts > pts)
+        // found nothing low enough, use the first one
+        return seekpoint_pair_t( *it_begin, Seekpoint() );
+
     iterator it_before = it_middle;
     iterator it_after = it_middle == it_end ? it_middle : next_( it_middle ) ;
 



More information about the vlc-commits mailing list