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()