diff options
author | wm4 <wm4@nowhere> | 2016-06-11 18:40:08 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-06-11 18:40:08 +0200 |
commit | bb9aad097a0e9eaa71ac92890fc9d2176f74911d (patch) | |
tree | ce9d5c44b098631a4d72162738940dd531dabd76 /player/osd.c | |
parent | 9fcc517cee13ad446ddbf40cd63c013d50fd14d0 (diff) | |
download | mpv-bb9aad097a0e9eaa71ac92890fc9d2176f74911d.tar.bz2 mpv-bb9aad097a0e9eaa71ac92890fc9d2176f74911d.tar.xz |
player: do not update OSD all the time when paused
Normally, OSD is updated every time the playloop is run. This has to be
done, because the OSD may implicitly reference various properties,
without knowing whether they really need to be updated or not. (There's
a property update mechanism, but it's mostly unavailable, because OSD is
special-cased and can not use the client API mechanism properly.)
Normally, these updates are no problem, because the OSD is only actually
printed when the OSD text actually changes.
But commit d23ffd24 added a rate-limiting mechanism, which tries to
limit OSD updates at most every 50ms (or the next video frame). Since it
can't know in advance whether the OSD is going to change or not, this
simply waked up the player every 50ms.
Change this so that the player is updated only as part of general
updates determined through mp_notify(). (This function also notifies the
client API of changed properties.) The desired result is that the player
will not wake up at all in normal idle mode, but still update properties
that can change when paused, such as the cache.
This is mostly a cosmetic change (in the sense of making runtime
behavior just slightly better). It has the slightly more negative
consequence that properties which update implicitly (such as "clock")
will not update periodically anymore.
Diffstat (limited to 'player/osd.c')
-rw-r--r-- | player/osd.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/player/osd.c b/player/osd.c index 3a549c070e..de84421d93 100644 --- a/player/osd.c +++ b/player/osd.c @@ -492,6 +492,10 @@ void update_osd_msg(struct MPContext *mpctx) double now = mp_time_sec(); if (!mpctx->osd_force_update) { + // Assume nothing is going on at all. + if (!mpctx->osd_idle_update) + return; + double delay = 0.050; // update the OSD at most this often double diff = now - mpctx->osd_last_update; if (diff < delay) { @@ -500,6 +504,7 @@ void update_osd_msg(struct MPContext *mpctx) } } mpctx->osd_force_update = false; + mpctx->osd_idle_update = false; mpctx->osd_last_update = now; if (mpctx->osd_visible) { |