diff options
author | wm4 <wm4@nowhere> | 2019-12-24 16:02:24 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-12-24 16:02:24 +0100 |
commit | b9084dfd47881492b53bd660bfaea88e80f1e547 (patch) | |
tree | 56fc8e842943cae9b1af061171e435a7e817d73a /player/lua | |
parent | f868052872a1ce2aba9c3237263b804d7580528e (diff) | |
download | mpv-b9084dfd47881492b53bd660bfaea88e80f1e547.tar.bz2 mpv-b9084dfd47881492b53bd660bfaea88e80f1e547.tar.xz |
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.)
Diffstat (limited to 'player/lua')
-rw-r--r-- | player/lua/stats.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua index aa95592694..0749dbaf40 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -814,7 +814,7 @@ local function process_key_binding(oneshot) clear_screen() remove_page_bindings() if recorder then - mp.unregister_event(recorder) + mp.unobserve_property(recorder) recorder = nil end end @@ -822,7 +822,11 @@ local function process_key_binding(oneshot) else if not oneshot and (o.plot_vsync_jitter or o.plot_vsync_ratio) then 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() end display_timer:kill() |