diff options
author | Julian <MyFakeAcc.4@googlemail.com> | 2016-07-28 03:28:42 +0900 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-10-09 20:40:31 +0200 |
commit | 0242165b3c756bcb0cf39c0e27235d5be1d71ae0 (patch) | |
tree | d67689c67f8404e5eae923f743aa7d59f4e2dd10 /player/lua/stats.lua | |
parent | 9d8495a9603a0d5a99467c986fc50ea871960eec (diff) | |
download | mpv-0242165b3c756bcb0cf39c0e27235d5be1d71ae0.tar.bz2 mpv-0242165b3c756bcb0cf39c0e27235d5be1d71ae0.tar.xz |
stats: change coloring of performance data
Previously it used display-fps to determine coloration even when
display-sync was not even used.
Diffstat (limited to 'player/lua/stats.lua')
-rw-r--r-- | player/lua/stats.lua | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 001de404f1..8a88da8831 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -19,7 +19,7 @@ local o = { redraw_delay = 1, -- acts as duration in the toggling case ass_formatting = true, timing_warning = true, - timing_warning_th = 0.85, -- *no* warning threshold (warning when > dfps * timing_warning_th) + timing_warning_th = 0.85, -- *no* warning threshold (warning when > target_fps * timing_warning_th) timing_total = false, debug = false, @@ -65,7 +65,7 @@ local o = { options.read_options(o) local format = string.format --- Buffer for the "last" value of performance data for render/present/upload +-- Buffer for the "last" value of performance data for render/present/upload local plast = {{0}, {0}, {0}} -- Position in buffer local ppos = 1 @@ -179,8 +179,9 @@ local function append_perfdata(s) return end - local dfps = mp.get_property_number("display-fps", 0) - dfps = dfps > 0 and (1 / dfps * 1e6) + local ds = mp.get_property_bool("display-sync-active", false) + local target_fps = ds and mp.get_property_number("display-fps", 0) or mp.get_property_number("fps", 0) + if target_fps > 0 then target_fps = 1 / target_fps * 1e6 end local last_s = vo_p["render-last"] + vo_p["present-last"] + vo_p["upload-last"] local avg_s = vo_p["render-avg"] + vo_p["present-avg"] + vo_p["upload-avg"] @@ -189,11 +190,11 @@ local function append_perfdata(s) -- highlight i with a red border when t exceeds the time for one frame -- or yellow when it exceeds a given threshold local function hl(i, t) - if o.timing_warning and dfps > 0 then - if t > dfps then + if o.timing_warning and target_fps > 0 then + if t > target_fps then return format("{\\bord0.5}{\\3c&H0000FF&}%05d{\\bord%s}{\\3c&H%s&}", i, o.border_size, o.border_color) - elseif t > (dfps * o.timing_warning_th) then + elseif t > (target_fps * o.timing_warning_th) then return format("{\\bord0.5}{\\1c&H00DDDD&}%05d{\\bord%s}{\\1c&H%s&}", i, o.border_size, o.font_color) end |