summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-13 09:19:23 +0100
committerwm4 <wm4@nowhere>2017-01-13 09:19:28 +0100
commit1b44a560d758ef7d74bb601cb812543ba809d304 (patch)
treebc16f8477239288df6c53fac6777d886d2107c7e
parentdec079d312a2dcf73d20446bebd2935e8a6a9e41 (diff)
downloadlibass-1b44a560d758ef7d74bb601cb812543ba809d304.tar.bz2
libass-1b44a560d758ef7d74bb601cb812543ba809d304.tar.xz
render_api: do not discard old images on reconfiguration
I noticed that when resizing the mpv window while playback is ongoing and with subtitles, that subtitles could sometimes get "stuck" on the screen. The stuck subtitle would remain until the next subtitle event, or until seeking to a position that has subtitles again. It turned out that this was a libass change detection bug. The following steps should reproduce the problem: 1. call ass_render_frame() with a time that has subtitles 2. call ass_set_frame_size() with a different size 3. call ass_render_frame() with a time that has no subtitles The previous call will return with *detect_change==0. To make this worse, libass will deallocate image data before the next ass_render_frame() or ass_renderer_done(), which violates the API and could possibly make some API users crash. (That the user can rely on this is not documented though.) There are two possible solutions: 1. Set a flag in ass_reconfigure(), that makes the next ass_render_frame() call always return *detect_change==2. 2. Do not discard the previous subtitles (images_root), so change detection can work reliably. This commit implements 2. - I prefer this in part because it doesn't clobber the previously returned image list before the next ass_render_frame() call. (As pointed out above, this might be unexpected behavior to the API user.) This is a regression and was possibly broken by commit dd06ca and later. I did not check whether it actually behaved sanely before that change, but it probably did to a degree.
-rw-r--r--libass/ass_render_api.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/libass/ass_render_api.c b/libass/ass_render_api.c
index d4b55de..2e61b7e 100644
--- a/libass/ass_render_api.c
+++ b/libass/ass_render_api.c
@@ -27,11 +27,9 @@ static void ass_reconfigure(ASS_Renderer *priv)
ASS_Settings *settings = &priv->settings;
priv->render_id++;
- ass_frame_unref(priv->images_root);
ass_cache_empty(priv->cache.composite_cache);
ass_cache_empty(priv->cache.bitmap_cache);
ass_cache_empty(priv->cache.outline_cache);
- priv->images_root = NULL;
priv->width = settings->frame_width;
priv->height = settings->frame_height;