summaryrefslogtreecommitdiffstats
path: root/sub/sd_ass.c
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2024-01-11 14:54:25 +0100
committerDudemanguy <random342@airmail.cc>2024-01-20 16:08:07 +0000
commit0f2370476b4279040261878c601fb8015a8502d7 (patch)
tree5d7715c9a44da2597435248ee35567638e126010 /sub/sd_ass.c
parent5f7ce41371b45e46efb7a8f2255a4b7332d152e9 (diff)
downloadmpv-0f2370476b4279040261878c601fb8015a8502d7.tar.bz2
mpv-0f2370476b4279040261878c601fb8015a8502d7.tar.xz
sub: fix sub-seek and sub-step -1 with unknown duration subs
f9cefbfec4 made it so mp_ass_flush_old_events() is continously called on subtitles with unknown duration, without explaining why, breaking sub-seek/step -1 with a VO (the issue does not occur when showing subtitles in the terminal because get_bitmaps() is not called). I don't experience any issue after removing the call, so delete it to fix these commands. After removing that, you can sub-seek -1 once after regular playback, but not after seeking and thus not multiple times in a row. This is caused by a714f8e928 which fixed subtitles with unknown duration being duplicated when seeking with a VO (it does not happen in the terminal) by clearing old lines on seeks, which broke sub-seek -1 and sub-step -1 in a second way after any seek. The proper fix is to remove the line ctx->num_seen_packets = 0 for subtitles with unknown duration instead, which lets decode() return early when a line has already been shown. Having removed these 2 lines, I also removed sd->preload_ok = false, and thus the whole conditional, since according to sub/sd.h preload_ok only needs to be set to false when old subtitles are discarded, and they are no longer discarded, The bug can be reproduced with mpv --sub-file=<(curl 'https://music.xianqiao.wang/neteaseapiv2/lyric?id=1399616170' | jq -r .lrc.lyric) 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
Diffstat (limited to 'sub/sd_ass.c')
-rw-r--r--sub/sd_ass.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c
index 81d665d70d..f67f997669 100644
--- a/sub/sd_ass.c
+++ b/sub/sd_ass.c
@@ -605,11 +605,6 @@ static struct sub_bitmaps *get_bitmaps(struct sd *sd, struct mp_osd_res dim,
ass_set_storage_size(renderer, 0, 0);
}
long long ts = find_timestamp(sd, pts);
- if (ctx->duration_unknown && pts != MP_NOPTS_VALUE) {
- mp_ass_flush_old_events(track, ts);
- ctx->num_seen_packets = 0;
- sd->preload_ok = false;
- }
if (no_ass)
fill_plaintext(sd, pts);
@@ -813,7 +808,7 @@ static void fill_plaintext(struct sd *sd, double pts)
static void reset(struct sd *sd)
{
struct sd_ass_priv *ctx = sd->priv;
- if (sd->opts->sub_clear_on_seek || ctx->duration_unknown || ctx->clear_once) {
+ if (sd->opts->sub_clear_on_seek || ctx->clear_once) {
ass_flush_events(ctx->ass_track);
ctx->num_seen_packets = 0;
sd->preload_ok = false;