[vlc-commits] mkv: skip decoding of blocks that are not necessary
Filip Roséen
git at videolan.org
Mon May 9 15:09:30 CEST 2016
vlc | branch: master | Filip Roséen <filip at videolabs.io> | Mon May 9 14:53:17 2016 +0200| [f79a9ff71a1442abf62c9e732a494d2cf7da60a3] | committer: Jean-Baptiste Kempf
mkv: skip decoding of blocks that are not necessary
Since the seeking algorithm(s) will set track.i_skip_until_fpos to a
value other than uint64_t( -1 ) (equivalent of the usage of
std::numeric_limits), we can ignore blocks with a lower file-position in
the Demuxer (and hence not send them to the decoder).
This will save us some time, while maintaining the proper state of the
relevant decoders.
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f79a9ff71a1442abf62c9e732a494d2cf7da60a3
---
modules/demux/mkv/mkv.cpp | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index c064376..d85f809 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -736,8 +736,35 @@ static int Demux( demux_t *p_demux)
return 0;
}
+ {
+ matroska_segment_c::tracks_map_t::iterator track_it;
+
+ if( p_segment->FindTrackByBlock( &track_it, block, simpleblock ) )
+ {
+ msg_Err( p_demux, "invalid track number" );
+ delete block;
+ return 0;
+ }
+
+ matroska_segment_c::tracks_map_t::mapped_type& track = track_it->second;
+
+
+ if( track.i_skip_until_fpos != std::numeric_limits<uint64_t>::max() ) {
+ uint64_t block_fpos = 0;
+ if( block ) block_fpos = block->GetElementPosition();
+ else block_fpos = simpleblock->GetElementPosition();
+
+ if ( track.i_skip_until_fpos > block_fpos )
+ {
+ delete block;
+ return 1; // this block shall be ignored
+ }
+
+ track.i_skip_until_fpos = -1;
+ }
+ }
/* update pcr */
{
More information about the vlc-commits
mailing list