From dfc060f0991255858d8286c3e77196b8762daf48 Mon Sep 17 00:00:00 2001 From: Dan Elkouby Date: Sat, 2 Nov 2019 15:24:56 +0200 Subject: ass_mp: reset packer when allocation fails Sometimes the atlas can get so large that it exceeds the maximum allowed size for an mp_image. Since the atlas will never shrink naturally, this breaks subtitles entirely until mpv is restarted. Reset the packer so that subtitles can rendered properly once the atlas fits again. This is a partial workaround for #6286. --- sub/ass_mp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sub/ass_mp.c b/sub/ass_mp.c index bb003a3edd..d5d9e3e7d6 100644 --- a/sub/ass_mp.c +++ b/sub/ass_mp.c @@ -230,8 +230,10 @@ static bool pack(struct mp_ass_packer *p, struct sub_bitmaps *res, int imgfmt) { talloc_free(p->cached_img); p->cached_img = mp_image_alloc(imgfmt, p->packer->w, p->packer->h); - if (!p->cached_img) + if (!p->cached_img) { + packer_reset(p->packer); return false; + } talloc_steal(p, p->cached_img); } -- cgit v1.2.3