diff options
author | wm4 <wm4@nowhere> | 2014-08-28 17:35:50 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-08-28 17:49:09 +0200 |
commit | fb1266c98b409e0ff9a2c6bb2422879132b3922d (patch) | |
tree | 32b39734b2daf8750ee94d762f3c01b35f3735d5 /player/playloop.c | |
parent | f9f436a49093bed07e9a14ad2c7b974bb7e32f36 (diff) | |
download | mpv-fb1266c98b409e0ff9a2c6bb2422879132b3922d.tar.bz2 mpv-fb1266c98b409e0ff9a2c6bb2422879132b3922d.tar.xz |
player: update cache state only if requested
Add a mechanism to the client API code, which allows the player core to
query whether a client API event is needed at all. Use it for the cache
update.
In this case, this is probably a pure microoptimization; but the
mechanism will be useful for other things too.
Diffstat (limited to 'player/playloop.c')
-rw-r--r-- | player/playloop.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/player/playloop.c b/player/playloop.c index dcbda59f13..4aaeacff16 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -49,6 +49,7 @@ #include "video/out/vo.h" #include "core.h" +#include "client.h" #include "command.h" void pause_player(struct MPContext *mpctx) @@ -556,7 +557,11 @@ static void handle_pause_on_low_cache(struct MPContext *mpctx) } // Also update cache properties. - bool busy = idle == 0 || !s.idle; + bool busy = idle == 0; + if (!s.idle) { + busy |= idle != -1; + busy |= mp_client_event_is_registered(mpctx, MP_EVENT_CACHE_UPDATE); + } if (busy || mpctx->next_cache_update > 0) { double now = mp_time_sec(); if (mpctx->next_cache_update <= now) { |