mirror of
https://github.com/mpv-player/mpv
synced 2024-12-19 13:21:13 +00:00
stats: do not use "tick" event
It's deprecated. The new solution works almost exactly the same way (since the still existing internal tick event triggers vsync-jitter change command), though as far as API usage goes, it's somewhat questionable. (The comment is meant to discourage anyone trying to copy the idea for external scripts.)
This commit is contained in:
parent
f868052872
commit
b9084dfd47
@ -814,7 +814,7 @@ local function process_key_binding(oneshot)
|
|||||||
clear_screen()
|
clear_screen()
|
||||||
remove_page_bindings()
|
remove_page_bindings()
|
||||||
if recorder then
|
if recorder then
|
||||||
mp.unregister_event(recorder)
|
mp.unobserve_property(recorder)
|
||||||
recorder = nil
|
recorder = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -822,7 +822,11 @@ local function process_key_binding(oneshot)
|
|||||||
else
|
else
|
||||||
if not oneshot and (o.plot_vsync_jitter or o.plot_vsync_ratio) then
|
if not oneshot and (o.plot_vsync_jitter or o.plot_vsync_ratio) then
|
||||||
recorder = record_data(o.skip_frames)
|
recorder = record_data(o.skip_frames)
|
||||||
mp.register_event("tick", recorder)
|
-- Rely on the fact that "vsync-ratio" is updated at the same time.
|
||||||
|
-- Using "none" to get a sample any time, even if it does not change.
|
||||||
|
-- Will stop working if "vsync-jitter" property change notification
|
||||||
|
-- changes, but it's fine for an internal script.
|
||||||
|
mp.observe_property("vsync-jitter", "none", recorder)
|
||||||
cache_recorder_timer:resume()
|
cache_recorder_timer:resume()
|
||||||
end
|
end
|
||||||
display_timer:kill()
|
display_timer:kill()
|
||||||
|
Loading…
Reference in New Issue
Block a user