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: Fix exceptions in StreamingEngine when reloading #6466

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 8 additions & 14 deletions lib/media/streaming_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -1922,9 +1922,16 @@ shaka.media.StreamingEngine = class {
otherState = this.mediaStates_.get(ContentType.VIDEO);
}
if (otherState) {
// First, abort all operations in progress on the other stream.
await this.abortOperations_(otherState).catch(() => {});
// Then clear our cache of the last init segment, since MSE will be
// reloaded and no init segment will be there post-reload.
otherState.lastInitSegmentReference = null;
// Now force the existing buffer to be cleared. It is not necessary
// to perform the MSE clear operation, but this has the side-effect
// that our state for that stream will then match MSE's post-reload
// state.
this.forceClearBuffer_(otherState);
this.abortOperations_(otherState).catch(() => {});
}
}

Expand Down Expand Up @@ -1955,19 +1962,6 @@ shaka.media.StreamingEngine = class {
appendWindowEnd, ignoreTimestampOffset,
reference.mimeType || mediaState.stream.mimeType,
reference.codecs || mediaState.stream.codecs, streamsByType);
if (isResetMediaSourceNecessary) {
let otherState = null;
if (mediaState.type === ContentType.VIDEO) {
otherState = this.mediaStates_.get(ContentType.AUDIO);
} else if (mediaState.type === ContentType.AUDIO) {
otherState = this.mediaStates_.get(ContentType.VIDEO);
}
if (otherState) {
otherState.waitingToClearBuffer = false;
otherState.performingUpdate = false;
this.forceClearBuffer_(otherState);
}
}
} catch (error) {
mediaState.lastAppendWindowStart = null;
mediaState.lastAppendWindowEnd = null;
Expand Down