VolatileBuffers let the OS reclaim memory (from unlocked buffers) when it needs to. This would let us significantly increase the eviction threshold (or possibly remove it entirely). I think the simplest thing to do would be to ensure that all data from the current time (according to SourceBufferResource::mOffset) onwards is always locked, so that we only ever get earlier data discarded. We'd need to add a way to request locking from a specific position (or possibly just implement Pin/Unpin), so that MediaSourceReader::Seek can ensure that we don't discard the same data that we're waiting on. SourceBufferResource::GetCachedRanges would also need to iterate over the segments (up until we get to mOffset) and check that they haven't been discarded. There may be other changes required since the buffer isn't necessarily contiguous anymore. Testing this will be hard. I think we'll still want to listen for memory-pressure events, since not all platforms implement VolatileBuffers in a useful way.
The MSE spec requires that we only discard data during an update, so this would violate the spec.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.