Commit f79a9ff7 authored by Filip Roséen's avatar Filip Roséen Committed by Jean-Baptiste Kempf
Browse files

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's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 353986b4
......@@ -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 */
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment