From 19aaa33a860794338847f0d24e5e409307a6a6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Wed, 14 Oct 2026 00:08:12 +0200 Subject: [PATCH] sd_ass: keep the seen and animated state on the original packet Free the filtered packet right after libass took it and run the bookkeeping on the original packet, which carries the seen and animated state. --- sub/sd_ass.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sub/sd_ass.c b/sub/sd_ass.c index db4d67daca..a154e2f73e 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -387,6 +387,10 @@ static void filter_and_add(struct sd *sd, struct demux_packet *pkt) ass_process_chunk(ctx->ass_track, pkt->buffer, pkt->len, floor(pkt->pts * 1000 + 1e-6), floor(pkt->duration * 1000 + 1e-6)); + if (pkt != orig_pkt) + talloc_free(pkt); + // the seen and animated state is kept on the original packet + pkt = orig_pkt; // This bookkeeping only has any practical use for ASS subs // over a VO with no video. @@ -416,9 +420,6 @@ static void filter_and_add(struct sd *sd, struct demux_packet *pkt) } } } - - if (pkt != orig_pkt) - talloc_free(pkt); } // Test if the packet with the given file position and pts was already consumed.