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

[DRAFT] Skip over segments that fail to reload (by applying GAP tags) #6171

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
23 changes: 15 additions & 8 deletions src/controller/base-stream-controller.ts
Expand Up @@ -1539,7 +1539,7 @@ export default class BaseStreamController
}
// keep retrying until the limit will be reached
const errorAction = data.errorAction;
const { action, retryCount = 0, retryConfig } = errorAction || {};
const { action, retryCount = 0, retryConfig, flags } = errorAction || {};
if (
errorAction &&
action === NetworkErrorAction.RetryRequest &&
Expand Down Expand Up @@ -1571,11 +1571,12 @@ export default class BaseStreamController
this.warn(
`${data.details} reached or exceeded max retry (${retryCount})`,
);
if (action === NetworkErrorAction.SendAlternateToPenaltyBox && flags) {
this.treatAsGap(frag);
}
return;
}
} else if (
errorAction?.action === NetworkErrorAction.SendAlternateToPenaltyBox
) {
} else if (action === NetworkErrorAction.SendAlternateToPenaltyBox) {
this.state = State.WAITING_LEVEL;
} else {
this.state = State.ERROR;
Expand Down Expand Up @@ -1752,10 +1753,7 @@ export default class BaseStreamController
);
if (level.fragmentError === 0) {
// Mark and track the odd empty segment as a gap to avoid reloading
level.fragmentError++;
frag.gap = true;
this.fragmentTracker.removeFragment(frag);
this.fragmentTracker.fragBuffered(frag, true);
this.treatAsGap(frag, level);
}
this.warn(error.message);
this.hls.trigger(Events.ERROR, {
Expand All @@ -1776,6 +1774,15 @@ export default class BaseStreamController
this.hls.trigger(Events.FRAG_PARSED, { frag, part });
}

private treatAsGap(frag: Fragment, level?: Level) {
if (level) {
level.fragmentError++;
}
frag.gap = true;
this.fragmentTracker.removeFragment(frag);
this.fragmentTracker.fragBuffered(frag, true);
}

protected resetTransmuxer() {
if (this.transmuxer) {
this.transmuxer.destroy();
Expand Down