osc: more frequent cache updates: from 10% diff to 5% or 5s

Cache display updates, especially when it's bigger than few minute,
could have been be very infrequent to the point that one is not sure
if it updates at all.

Reduce the 10% change-threshold to 5% and add another threshold of 5s.
This commit is contained in:
Avi Halachmi (:avih) 2020-01-11 14:40:46 +02:00
parent 3259494d9e
commit 40832773c1
1 changed files with 2 additions and 2 deletions

View File

@ -2021,8 +2021,8 @@ function osc_init()
return ""
end
local dmx_cache = mp.get_property_number("demuxer-cache-duration")
if dmx_cache and (dmx_cache > state.dmx_cache * 1.1 or
dmx_cache < state.dmx_cache * 0.9) then
local thresh = math.min(state.dmx_cache * 0.05, 5) -- 5% or 5s
if dmx_cache and math.abs(dmx_cache - state.dmx_cache) >= thresh then
state.dmx_cache = dmx_cache
else
dmx_cache = state.dmx_cache