summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-26 18:35:36 +0100
committerwm4 <wm4@nowhere>2015-12-26 18:35:36 +0100
commit190dea149aea07bc4be41c684a50db4231ccb0da (patch)
treeb4c164a1c741dd6c2283b3559d3b807b2ca8c226 /player
parent8d4a179c144cb3e36762b2c3cef55d1d3bb9f951 (diff)
downloadmpv-190dea149aea07bc4be41c684a50db4231ccb0da.tar.bz2
mpv-190dea149aea07bc4be41c684a50db4231ccb0da.tar.xz
sub: destroy/recreate ASS_Renderer when disabling/enablings subs
Keeping ASS_Renderers around for a potentially large number of subtitle tracks could lead to excessive memory usage, especially since the libass cache is broken (caches even unneeded data), and might consume up to ~500MB of memory for no reason.
Diffstat (limited to 'player')
-rw-r--r--player/sub.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/player/sub.c b/player/sub.c
index 9c69df39ab..059dbdc2fd 100644
--- a/player/sub.c
+++ b/player/sub.c
@@ -55,6 +55,7 @@ void uninit_sub(struct MPContext *mpctx, int order)
{
if (mpctx->d_sub[order]) {
reset_subtitles(mpctx, order);
+ sub_select(mpctx->d_sub[order], false);
mpctx->d_sub[order] = NULL; // not destroyed
osd_set_sub(mpctx->osd, OSDTYPE_SUB + order, NULL);
reselect_demux_streams(mpctx);
@@ -183,6 +184,7 @@ void reinit_subs(struct MPContext *mpctx, int order)
track->dec_sub = sub_create(mpctx->global);
mpctx->d_sub[order] = track->dec_sub;
+ sub_select(track->dec_sub, true);
reinit_subdec(mpctx, track);
osd_set_sub(mpctx->osd, OSDTYPE_SUB + order, track->dec_sub);
sub_control(track->dec_sub, SD_CTRL_SET_TOP, &(bool){!!order});