aboutsummaryrefslogtreecommitdiffhomepage
path: root/demux
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2015-10-12 21:19:43 +0200
committerGravatar wm4 <wm4@nowhere>2015-10-12 21:19:43 +0200
commit14a2993796c4f6ab0cb65e656a9b06c0672c79d2 (patch)
tree240478db911afe74615b2d6dbc3984d03ea3f368 /demux
parent3804376ccce6d7b3b9a93cbc53b490705d2b6f3e (diff)
demux_mkv: do not return subtitle packets that end before seek target
This affects the subtitle preroll mode during seeking. It could matter somewhat with insane files with ten-thousands of subtitle events, which now seem to pop up, and will avoid packet queue overflow.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_mkv.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index e2743d5ef8..daf03d615b 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -2389,8 +2389,12 @@ static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
if (mkv_d->a_skip_to_keyframe)
use_this_block &= keyframe;
} else if (track->type == MATROSKA_TRACK_SUBTITLE) {
- if (!use_this_block && mkv_d->subtitle_preroll)
- use_this_block = 1;
+ if (!use_this_block && mkv_d->subtitle_preroll) {
+ int64_t end_time = block_info->timecode + block_info->duration;
+ if (!block_info->duration)
+ end_time = INT64_MAX;
+ use_this_block = end_time > mkv_d->skip_to_timecode;
+ }
if (use_this_block) {
if (mkv_d->subtitle_preroll) {
mkv_d->subtitle_preroll--;