Skip to content
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

fix(HLS): Avoid HLS resync when there is a gap in the stream #5284

Merged
merged 2 commits into from
Jun 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,15 @@ shaka.media.StreamingEngine = class {
const mediaState = this.mediaStates_.get(type);
const logPrefix = shaka.media.StreamingEngine.logPrefix_(mediaState);

// Always clear the iterator since we need to start streaming from the
// new time. This also happens in clearBuffer_, but if we don't clear,
// we still want to reset the iterator.
mediaState.segmentIterator = null;
let segment = null;
if (mediaState.segmentIterator) {
segment = mediaState.segmentIterator.current();
}
// Only reset the iterator if we seek outside the current segment.
if (!segment || segment.startTime > presentationTime ||
avelad marked this conversation as resolved.
Show resolved Hide resolved
segment.endTime < presentationTime) {
mediaState.segmentIterator = null;
}

if (!newTimeIsBuffered(type)) {
const bufferEnd =
Expand Down