summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorAvi Halachmi (:avih) <avihpit@yahoo.com>2022-02-23 01:50:47 +0200
committerAvi Halachmi (:avih) <avihpit@yahoo.com>2022-02-23 02:20:49 +0200
commit57f42cee84aa5b48eb2db32e8b429796a3d7fb11 (patch)
tree3153c6bc8eb35d97526a7e917df4827e942c7cc7 /player
parent37927b65f719aac817717c88c10b05ca7246248a (diff)
downloadmpv-57f42cee84aa5b48eb2db32e8b429796a3d7fb11.tar.bz2
mpv-57f42cee84aa5b48eb2db32e8b429796a3d7fb11.tar.xz
stats.lua: page 2 - frame timing: use fixed display order
Page 2 displays the frame timing info for each type (currently "Fresh" and "Redraw"), but since they're unordered keys of a map, their iteration order and hence their order on screen could (and did) change depending on $things, which was annoying. haasn thinks none of them should be considered more important (and therefore maybe worthy of being displayed on top), so we go with lexicographic order, which currently means that "Fresh" is first. Fixes #9901
Diffstat (limited to 'player')
-rw-r--r--player/lua/stats.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua
index 4ae5aaa73a..c823541ffc 100644
--- a/player/lua/stats.lua
+++ b/player/lua/stats.lua
@@ -280,6 +280,14 @@ local function append_property(s, prop, attr, excluded)
return append(s, ret, attr)
end
+local function sorted_keys(t, comp_fn)
+ local keys = {}
+ for k,_ in pairs(t) do
+ keys[#keys+1] = k
+ end
+ table.sort(keys, comp_fn)
+ return keys
+end
local function append_perfdata(s, dedicated_page)
local vo_p = mp.get_property_native("vo-passes")
@@ -327,7 +335,8 @@ local function append_perfdata(s, dedicated_page)
b("Frame Timings:"), o.prefix_sep, o.font_size * 0.66,
"(last/average/peak μs)", o.font_size)
- for frame, data in pairs(vo_p) do
+ for _,frame in ipairs(sorted_keys(vo_p)) do -- ensure fixed display order
+ local data = vo_p[frame]
local f = "%s%s%s{\\fn%s}%s / %s / %s %s%s{\\fn%s}%s%s%s"
if dedicated_page then