fix: ensure cache ranges extend to 0 and duration (#253)

This commit is contained in:
christoph-heinrich
2022-09-23 22:50:06 +02:00
committed by GitHub
parent df37ca748e
commit 940e6eaf86

View File

@@ -4324,6 +4324,8 @@ mp.observe_property('demuxer-cache-state', 'native', function(prop, cache_state)
}
end
table.sort(ranges, function(a, b) return a[1] < b[1] end)
if cache_state['bof-cached'] then ranges[1][1] = 0 end
if cache_state['eof-cached'] then ranges[#ranges][2] = state.duration end
-- Invert cached ranges into uncached ranges, as that's what we're rendering
local inverted_ranges = {{0, state.duration}}
for _, cached in pairs(ranges) do