From fe758a1761272e1b734fd1930fed5e635da6e500 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Mon, 14 Oct 2024 15:44:25 -0500 Subject: [PATCH] player/command: destroy cached packets after UPDATE_SUB_{FILT,HARD} Otherwise, the index can technically grow forever because sub_read_packets will trigger again, read the same packets, then add them to the list. We should just clear the cache here in this case to reset it back to 0. Also flag redraw_subs here as well. --- player/command.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/player/command.c b/player/command.c index 5f2b1c0f0d..f332f0e1cd 100644 --- a/player/command.c +++ b/player/command.c @@ -7426,11 +7426,14 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags, (void *)(uintptr_t)flags); if (ret == CONTROL_OK && flags & (UPDATE_SUB_FILT | UPDATE_SUB_HARD)) { sub_redecode_cached_packets(sub); + sub_reset(sub); if (track->selected) reselect_demux_stream(mpctx, track, true); } } } + // For subs on a still image. + redraw_subs(mpctx); osd_changed(mpctx->osd); }