[vlc-commits] demux:mkv: do not filter old blocks in fast seeking

Steve Lhomme git at videolan.org
Thu Feb 1 16:53:58 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Feb  1 16:52:50 2018 +0100| [b931935a4bad26fa1330860d2b17d2c688ca0547] | committer: Steve Lhomme

demux:mkv: do not filter old blocks in fast seeking

And only set ES_OUT_SET_NEXT_DISPLAY_TIME once per seek.

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

 modules/demux/mkv/matroska_segment.cpp | 25 ++++++++++++++++++-------
 modules/demux/mkv/matroska_segment.hpp |  1 +
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 311b19748f..86c07b9900 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -771,7 +771,7 @@ bool matroska_segment_c::LoadSeekHeadItem( const EbmlCallbacks & ClassInfos, int
 
 bool matroska_segment_c::FastSeek( demux_t &demuxer, mtime_t i_mk_date, mtime_t i_mk_time_offset )
 {
-    if( Seek( demuxer, i_mk_date, i_mk_time_offset ) )
+    if( InternalSeek( demuxer, i_mk_date, i_mk_time_offset, false ) )
     {
         sys.i_start_pts = sys.i_pts;
         es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, sys.i_start_pts );
@@ -780,7 +780,17 @@ bool matroska_segment_c::FastSeek( demux_t &demuxer, mtime_t i_mk_date, mtime_t
     return false;
 }
 
-bool matroska_segment_c::Seek( demux_t &demuxer, mtime_t i_absolute_mk_date, mtime_t i_mk_time_offset )
+bool matroska_segment_c::Seek( demux_t &demuxer, mtime_t i_mk_date, mtime_t i_mk_time_offset )
+{
+    if( InternalSeek( demuxer, i_mk_date, i_mk_time_offset, true ) )
+    {
+        es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, sys.i_start_pts );
+        return true;
+    }
+    return false;
+}
+
+bool matroska_segment_c::InternalSeek( demux_t &demuxer, mtime_t i_absolute_mk_date, mtime_t i_mk_time_offset, bool b_accurate )
 {
     SegmentSeeker::tracks_seekpoint_t seekpoints;
 
@@ -846,7 +856,10 @@ bool matroska_segment_c::Seek( demux_t &demuxer, mtime_t i_absolute_mk_date, mti
             i_mk_seek_time  = it->second.pts;
         }
 
-        trackit->second->i_skip_until_fpos = it->second.fpos;
+        if ( b_accurate )
+            trackit->second->i_skip_until_fpos = it->second.fpos;
+        else
+            trackit->second->i_skip_until_fpos = -1;
         trackit->second->i_last_dts        = it->second.pts;
 
         msg_Dbg( &sys.demuxer, "seek: preroll{ track: %u, pts: %" PRId64 ", fpos: %" PRIu64 " } ",
@@ -859,16 +872,14 @@ bool matroska_segment_c::Seek( demux_t &demuxer, mtime_t i_absolute_mk_date, mti
     sys.i_pts       = VLC_TS_0 + i_mk_seek_time + i_mk_time_offset;
     sys.i_start_pts = VLC_TS_0 + i_absolute_mk_date;
 
-    es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, sys.i_start_pts );
-
     // make the jump //
 
     _seeker.mkv_jump_to( *this, i_seek_position );
 
     // debug diagnostics //
 
-    msg_Dbg( &sys.demuxer, "seek: preroll{ start-pts: %" PRId64 ", start-fpos: %" PRIu64 "} ",
-      sys.i_pts, i_seek_position );
+    msg_Dbg( &sys.demuxer, "seek: preroll{ req: %" PRId64 ", start-pts: %" PRId64 ", start-fpos: %" PRIu64 "} ",
+      sys.i_start_pts, sys.i_pts, i_seek_position );
 
     return true;
 }
diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp
index 8c102bebb4..f0f7ec34cf 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -171,6 +171,7 @@ private:
     bool TrackInit( mkv_track_t * p_tk );
     void ComputeTrackPriority();
     void EnsureDuration();
+    bool InternalSeek( demux_t &, mtime_t i_mk_date, mtime_t i_mk_time_offset, bool b_accurate );
 
     SegmentSeeker _seeker;
 



More information about the vlc-commits mailing list