mirror of
https://github.com/mpv-player/mpv
synced 2025-04-18 05:07:18 +00:00
osc.lua: avoid infinite ticks loop on idle
Before this commit, animation-end was handled at render(), however, it's not called on idle, which resulted in state.anitype ~= nil, with nothing to reset it during idle, which caused in an infinite tick() loop (starts on first mouse move). Now tick resets the animation on idle, and also, as a safety measure, if we're past 1s after the animation deadline. The safety measure is because the osc states are complex, and it's easier to detect a "we really shouldn't be animating now" at tick() itself rather than detecting the exact states where animation should be reset. Generally, the safety mmeasure is not needed.
This commit is contained in:
parent
bc6dab6d92
commit
ca6108baf4
@ -2609,7 +2609,17 @@ function tick()
|
||||
state.tick_last_time = mp.get_time()
|
||||
|
||||
if state.anitype ~= nil then
|
||||
request_tick()
|
||||
-- state.anistart can be nil - animation should now start, or it can
|
||||
-- be a timestamp when it started. state.idle has no animation.
|
||||
if not state.idle and
|
||||
(not state.anistart or
|
||||
mp.get_time() < 1 + state.anistart + user_opts.fadeduration/1000)
|
||||
then
|
||||
-- animating or starting, or still within 1s past the deadline
|
||||
request_tick()
|
||||
else
|
||||
kill_animation()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user