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

Bugfix: Playlist loading errors must be fatal after all levels and retries exhausted #5498

Merged
merged 1 commit into from
May 24, 2023
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions src/controller/audio-stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,12 @@ class AudioStreamController
const { frag, part } = data;
if (frag.type !== PlaylistLevelType.AUDIO) {
if (!this.loadedmetadata && frag.type === PlaylistLevelType.MAIN) {
if ((this.videoBuffer || this.media)?.buffered.length) {
this.loadedmetadata = true;
const bufferable = this.videoBuffer || this.media;
if (bufferable) {
const bufferedTimeRanges = BufferHelper.getBuffered(bufferable);
if (bufferedTimeRanges.length) {
this.loadedmetadata = true;
}
}
}
return;
Expand Down
3 changes: 3 additions & 0 deletions src/controller/base-playlist-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ export default class BasePlaylistController implements NetworkComponentAPI {
action === NetworkErrorAction.SendAlternateToPenaltyBox));
if (retry) {
this.requestScheduled = -1;
if (retryCount >= retryConfig.maxNumRetry) {
return false;
}
if (isTimeout && errorEvent.context?.deliveryDirectives) {
// The LL-HLS request already timed out so retry immediately
this.warn(
Expand Down
7 changes: 7 additions & 0 deletions src/controller/error-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default class ErrorController implements NetworkComponentAPI {
const hls = this.hls;
hls.on(Events.ERROR, this.onError, this);
hls.on(Events.MANIFEST_LOADING, this.onManifestLoading, this);
hls.on(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
}

private unregisterListeners() {
Expand All @@ -82,6 +83,7 @@ export default class ErrorController implements NetworkComponentAPI {
hls.off(Events.ERROR, this.onError, this);
hls.off(Events.ERROR, this.onErrorOut, this);
hls.off(Events.MANIFEST_LOADING, this.onManifestLoading, this);
hls.off(Events.LEVEL_UPDATED, this.onLevelUpdated, this);
}

destroy() {
Expand All @@ -108,6 +110,10 @@ export default class ErrorController implements NetworkComponentAPI {
this.penalizedRenditions = {};
}

private onLevelUpdated() {
this.playlistError = 0;
}

private onError(event: Events.ERROR, data: ErrorData) {
if (data.fatal) {
return;
Expand Down Expand Up @@ -371,6 +377,7 @@ export default class ErrorController implements NetworkComponentAPI {
}
if (nextLevel > -1 && hls.loadLevel !== nextLevel) {
data.levelRetry = true;
this.playlistError = 0;
return {
action: NetworkErrorAction.SendAlternateToPenaltyBox,
flags: ErrorActionFlags.None,
Expand Down