From 0c3df23335beb46d02d288d04ff080e18052d42f Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Nov 2014 17:32:34 +0100 Subject: osd: properly wakeup when the OSD function disappears Fixes #1236. --- player/osd.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'player') diff --git a/player/osd.c b/player/osd.c index d5c0ecc8ff..e59920dd03 100644 --- a/player/osd.c +++ b/player/osd.c @@ -359,6 +359,8 @@ void set_osd_function(struct MPContext *mpctx, int osd_function) mpctx->osd_function = osd_function; mpctx->osd_function_visible = mp_time_sec() + opts->osd_duration / 1000.0; + mpctx->osd_force_update = true; + mpctx->sleeptime = 0; } /** @@ -483,9 +485,14 @@ void update_osd_msg(struct MPContext *mpctx) } } - if (mpctx->osd_function_visible && now >= mpctx->osd_function_visible) { - mpctx->osd_function_visible = 0; - mpctx->osd_function = 0; + if (mpctx->osd_function_visible) { + double sleep = mpctx->osd_function_visible - now; + if (sleep > 0) { + mpctx->sleeptime = MPMIN(mpctx->sleeptime, sleep); + } else { + mpctx->osd_function_visible = 0; + mpctx->osd_function = 0; + } } if (mpctx->osd_msg_next_duration > 0) { -- cgit v1.2.3