diff options
author | wm4 <wm4@nowhere> | 2020-04-09 15:03:17 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-04-09 15:03:17 +0200 |
commit | 73e565dc0fdffc5eb8a1f9466a130867a7427183 (patch) | |
tree | 2deb57563281a95370f26e26c6803d1d8c91b494 /player/lua | |
parent | 7df9f81d2208c072379a918df2002631d49fe511 (diff) | |
download | mpv-73e565dc0fdffc5eb8a1f9466a130867a7427183.tar.bz2 mpv-73e565dc0fdffc5eb8a1f9466a130867a7427183.tar.xz |
stats: fix crash if both plot_vsync_* options are disabled
In this case, init_buffers() was not called, and the unrelated cache
sample buffers were not initialized. It appears they are indeed
completely unrelated, so move their initialization away. Not sure what
exactly the purpose of calling init_buffers() is, maybe clearing old
data when displaying stats again. The new place for initializing the
cache sample buffers should achieve the same anyway.
Fixes: #7597
Diffstat (limited to 'player/lua')
-rw-r--r-- | player/lua/stats.lua | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 93c2c99c18..161d99848f 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -95,13 +95,12 @@ local ass_stop = mp.get_property_osd("osd-ass-cc/1") -- Ring buffers for the values used to construct a graph. -- .pos denotes the current position, .len the buffer length -- .max is the max value in the corresponding buffer -local vsratio_buf, vsjitter_buf, cache_ahead_buf, cache_speed_buf +local vsratio_buf, vsjitter_buf local function init_buffers() vsratio_buf = {0, pos = 1, len = 50, max = 0} vsjitter_buf = {0, pos = 1, len = 50, max = 0} - cache_ahead_buf = {0, pos = 1, len = 50, max = 0} - cache_speed_buf = {0, pos = 1, len = 50, max = 0} end +local cache_ahead_buf, cache_speed_buf local perf_buffers = {} -- Save all properties known to this version of mpv local property_list = {} @@ -854,6 +853,10 @@ local function process_key_binding(oneshot) -- 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) + end + if not oneshot then + cache_ahead_buf = {0, pos = 1, len = 50, max = 0} + cache_speed_buf = {0, pos = 1, len = 50, max = 0} cache_recorder_timer:resume() end display_timer:kill() |