Fix m3u8 does not reload properly in low latency mode which causes buffer stalled #6975
+18
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fix move to use partTarget as reference for m3u8 reload interval if the low latency mode is enabled.
Why is this Pull Request needed?
Without this fix, m3u8 is reload after target-duration and cause the low latency stream buffer to be stalled, when the total parts loaded in the buffer is lower than target-duration (which is a property for normal-latency mode).
Are there any points in the code the reviewer needs to double check?
I think this can be optimized more (increase the interval to partTarget + hint.duration) to reduce m3u8 reload if PRELOAD HINT is fully supported as in #3988. However, it's risky as the PRELOAD HINT has to carefully check for whether the hinted part is fully available or not.
Resolves issues:
This manifest will cause hlsjs to be stuck as the very first m3u8 reload is set to 4 (TARGETDURATION) but the buffer loaded on 3 parts (PART-HOLD-BACK = 3.84):
Checklist