fix(hls): Fixed buffering issue with live HLS #4002
Merged
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.
HLS now appends segments in sequence mode. In order to handle seeks,
we set the timestampOffset property on SourceBuffer to the startTime of
the segment. This is done after every seek, or on startup.
For non-sequence-mode content (DASH), we normally set timestampOffset
based on the Period structure. This should be suppressed in sequence
mode, though, where only the reference startTime matters.
The buffering issue was caused by two things in combination:
change when a playlist was updated
even though this should be skipped in sequence mode
These two things in combination would lead MediaSourceEngine to start
inserting segments near the start of the presentation, rather than at
the live edge.
This changes MediaSourceEngine so that in sequence mode, timestampOffset
is ignored in setStreamProperties. This also cleans up the HLS parser
to set each reference's timestampOffset to 0, since they should be
ignored anyway.