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

Steve Lhomme git at videolan.org
Thu Feb 1 16:59:13 CET 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Feb  1 16:52:50 2018 +0100| [8cf2364cd40d1c6f862ec76a940e1ce02eb713da] | committer: Jean-Baptiste Kempf

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

And only set ES_OUT_SET_NEXT_DISPLAY_TIME once per seek.

(cherry picked from commit b931935a4bad26fa1330860d2b17d2c688ca0547)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 b2c4d62f7f..75dfb3abd1 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -793,7 +793,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 );
@@ -802,7 +802,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;
 
@@ -868,7 +878,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 " } ",
@@ -881,16 +894,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 637ef4eddf..c753644cc8 100644
--- a/modules/demux/mkv/matroska_segment.hpp
+++ b/modules/demux/mkv/matroska_segment.hpp
@@ -172,6 +172,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