summaryrefslogtreecommitdiffstats
path: root/libass/ass_render.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-30 00:45:59 +0200
committerGrigori Goronzy <greg@blackbox>2012-10-01 15:41:33 +0200
commit20f83b10241aa9c67c3a7e0c1a7e4d986fe199f1 (patch)
tree654b9357a13e7b6959f5f9483af15e6c9dd66620 /libass/ass_render.c
parent0594b9fcb5952448dee7eaa3646f7b1281ae8f80 (diff)
downloadlibass-20f83b10241aa9c67c3a7e0c1a7e4d986fe199f1.tar.bz2
libass-20f83b10241aa9c67c3a7e0c1a7e4d986fe199f1.tar.xz
Fix change detection when cache is cleared
check_cache_limits() clears the image list. If all subtitles disappear right in the frame the cache has been cleared, ass_detect_change() will see two empty image lists (old - not empty, but cleared, new - empty), and signal to the application that there was no change. As result, media players which rely on the change detection will keep displaying the last subtitle until the next subtitle event. This bug was found by uau and has been reported on IRC in February.
Diffstat (limited to 'libass/ass_render.c')
-rw-r--r--libass/ass_render.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libass/ass_render.c b/libass/ass_render.c
index f8b7987..b11c681 100644
--- a/libass/ass_render.c
+++ b/libass/ass_render.c
@@ -2204,12 +2204,14 @@ static void check_cache_limits(ASS_Renderer *priv, CacheStore *cache)
ass_cache_empty(cache->composite_cache, 0);
ass_free_images(priv->prev_images_root);
priv->prev_images_root = 0;
+ priv->cache_cleared = 1;
}
if (ass_cache_empty(cache->outline_cache, cache->glyph_max)) {
ass_cache_empty(cache->bitmap_cache, 0);
ass_cache_empty(cache->composite_cache, 0);
ass_free_images(priv->prev_images_root);
priv->prev_images_root = 0;
+ priv->cache_cleared = 1;
}
}
@@ -2475,6 +2477,9 @@ static int ass_detect_change(ASS_Renderer *priv)
ASS_Image *img, *img2;
int diff;
+ if (priv->cache_cleared)
+ return 2;
+
img = priv->prev_images_root;
img2 = priv->images_root;
diff = 0;
@@ -2571,6 +2576,7 @@ ASS_Image *ass_render_frame(ASS_Renderer *priv, ASS_Track *track,
// free the previous image list
ass_free_images(priv->prev_images_root);
priv->prev_images_root = 0;
+ priv->cache_cleared = 0;
return priv->images_root;
}