summaryrefslogtreecommitdiffstats
path: root/player/lua/defaults.lua
diff options
context:
space:
mode:
Diffstat (limited to 'player/lua/defaults.lua')
-rw-r--r--player/lua/defaults.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua
index 5e56c4fb4e..a1deca28ba 100644
--- a/player/lua/defaults.lua
+++ b/player/lua/defaults.lua
@@ -528,9 +528,18 @@ function mp.dispatch_events(allow_wait)
if not more_events then
wait = process_timers() or 1e20 -- infinity for all practical purposes
if wait ~= 0 then
+ local idle_called = nil
for _, handler in ipairs(idle_handlers) do
+ idle_called = true
handler()
end
+ if idle_called then
+ -- handlers don't complete in 0 time, and may modify timers
+ wait = mp.get_next_timeout() or 1e20
+ if wait < 0 then
+ wait = 0
+ end
+ end
end
-- Resume playloop - important especially if an error happened while
-- suspended, and the error was handled, but no resume was done.