summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-06-16 16:08:54 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commitc13bfd271c416d1c1fd8991f7058c289a40a4ea3 (patch)
treef42480de4c639708d03ed2a4876c5bb8019a6fc8
parent530b203e5d150362adbbbb49783e3d1a23a730f5 (diff)
downloadmpv-c13bfd271c416d1c1fd8991f7058c289a40a4ea3.tar.bz2
mpv-c13bfd271c416d1c1fd8991f7058c289a40a4ea3.tar.xz
demux_mkv: fix subtitle preroll in some cases
Subtitle packets with a timestamp before the seek target may overlap with the seek target anyway. This is why this subtitle preroll crap exists: it needs to return packets before the seek target to ensure that the subtitle is displayed at the seek target. This didn't always work. Maybe it's a regression, but it must have been an old one. The breakage is triggered by heuristic that is to prevent excessive queuing of packets in garbage files (this heuristic apparently became immediately necessary when this preroll mechanism was implemented). If a video keyframe packet was found, but no audio packet yet, then subtitle_preroll was set to 0, and since a_skip_to_keyframe was still 0, the subtitle packet was discarded. The dumb thing is that subtitle and video seeking is finished at this point, so the preroll crap should not be applied at all. Fix this by moving the preoll overflow code into the block that handles preroll.
-rw-r--r--demux/demux_mkv.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index a98d2864e6..c33fab3a2d 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -2652,14 +2652,13 @@ static int handle_block(demuxer_t *demuxer, struct block_info *block_info)
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--;
- } else {
- // This could overflow the demuxer queue.
- if (mkv_d->a_skip_to_keyframe || mkv_d->v_skip_to_keyframe)
+ if (use_this_block) {
+ if (mkv_d->subtitle_preroll) {
+ mkv_d->subtitle_preroll--;
+ } else {
+ // This could overflow the demuxer queue.
use_this_block = 0;
+ }
}
}
if (use_this_block) {