[Proposal] add a maxVideoBufferSize
constructor option to allow setting a limit for the size of pushed segments
#1054
Labels
API
Relative to the RxPlayer's API
Compatibility
Relative to the RxPlayer's compatibility with various devices and environments
Priority: 1 (High)
This issue or PR has a high priority.
Milestone
At Canal+, we're playing DASH contents with a big range of video qualities: from some very low quality video to something like UHD HDR qualities with a huge bitrate.
Higher qualities generally fill the device's memory much faster than the lower quality ones. On some devices with low memory (among which mostly smart TVs, chromecasts and set-top boxes), we rapidly can encounter a problem where the player cannot fill the buffer until the set
wantedBufferAhead
.Right now, the strategy has been to react to
QuotaExceededError
possibly thrown by the browser when the buffer is full, by reducing the actual buffer goal when it is emitted (instead of loading 30 seconds ahead as told by thewantedBufferAhead
option, we instead will load e.g. only 20 seconds).Yet this strategy has the following issues:
Due to all those considerations, we've recently thought about allowing a way to have an adaptive
wantedBufferAhead
.It would be at the normal target for non-problematic low quality (keeping it high here is even more important considering that people on low-bandwidth usually have higher risks of rebuffering) but much lower when on high qualities to avoid filling the memory.
But we cannot just rely on the current loaded quality (in which case, the application could do it by itself on player events) as already-buffered segments also may have an impact.
The solution we're currently experimenting is to let the application set a
maxVideoBufferSize
option (as a constructor option and/or through RxPlayer methods).The value of that option would be equal to the maximum size of data, in KB, that should be at any time in the browser video SourceBuffer.
As no browser API exist to announce the current size in that buffer, the RxPlayer estimates it by using its internal
SegmentInventory
, which is a structure keeping information about all segments currently present in the buffer. Those information now include the size of the loaded and compressed file, which is inferred to be roughly similar to the size kept in memory when pushed.For segments that are not yet loaded, the attribute corresponding to the Representation bitrate/bandwidth in the Manifest is used instead to estimate it.
Now there is a last issue with that strategy: what if no segment of the highest quality can be loaded under the condition of the
maxVideoBufferSize
? Written in a simpler way: what if even only one segment is already bigger than this limit?For now, we chose to officially declare this case as leading to an undefined behavior (to avoid having to set things in stones for the next versions) but in reality for now, the RxPlayer also set a minimum buffer size that should be attained (e.g. 5 seconds), which take precedence over the
maxVideoBufferSize
(so we'll have ~5 seconds of the highest quality instead of e.g. nothing or a lower quality).We may in the future choose another solution such as lowering the quality in that case.
As I'm writing this issue, the feature has already been developed (PR: #1041) and is currently tested.
This issue is just here to have a written trace of that work of the thoughts that led to it.
The text was updated successfully, but these errors were encountered: