New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add maxBufferAhead exception for text garbage collection #1325
Conversation
The `maxBufferAhead` RxPlayer option allows to manually garbage collect media data that is too far ahead from the playing position. It can be set to a number of seconds, and was previously applied to audio, video and text media segments. For example when setting `maxBufferAhead` to `30`, and playing at position `20`, we would remove if present media data already buffered a position `50` or more (which could for example mostly happen when seeking back in the content). We found out however that applying that same value to the text buffer may not always be sensible: - `maxBufferAhead` is most likely defined by an application to restrict memory usage. The space taken by the text cues have much less weight than audio and video - We encounter several contents where loaded text segments span for 1 minute because of how small those segments are. Here we risk progressively loading the same segment as its end will be GCed multiple times. Due to both of these situations, I decided for now to have a lower bound on the `maxBufferAhead` applied on the text buffer to 2 minutes. We also could have made the `maxBufferAhead` API more configurable by letting an application set a different setting per media type, but I thought that an application may not easily realize the issue.
When clearing data due to a Before clearing: A B C After clearing (current behavior): A B
After clearing (suggestion): A B
This may add to much complexities but it would handle the case if text segments are > 120s |
By So basically when GCing forward we shouldn't remove a segment which has a part of the data below it? Though in the current code we do risk re-downloading the same segment every We maybe could POC it. |
// of duration. Let's make an exception here by authorizing a | ||
// larger text buffer ahead, to avoid unnecesarily reloading the | ||
// same text track. | ||
Math.max(val, 2 * 60) : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can set this in the config file something like: MINIMUM_MAX_BUFFER_AHEAD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The
maxBufferAhead
RxPlayer option allows to manually garbage collect media data that is too far ahead from the playing position.It can be set to a number of seconds, and was previously applied to audio, video and text media segments.
For example when setting
maxBufferAhead
to30
, and playing at position20
, we would remove if present media data already buffered a position50
or more (which could for example mostly happen when seeking back in the content).We found out however that applying that same value to the text buffer may not always be sensible:
maxBufferAhead
is most likely defined by an application to restrict memory usage. The space taken by the text cues have much less weight than audio and videoDue to both of these situations, I decided for now to have a lower bound on the
maxBufferAhead
applied on the text buffer to 2 minutes. We also could have made themaxBufferAhead
API more configurable by letting an application set a different setting per media type, but I thought that an application may not easily realize the issue.