Skip to content

Commit

Permalink
Switch on FRAG_PARSING_ERROR or continue trying fragLoadPolicy.defaul…
Browse files Browse the repository at this point in the history
…t.errorRetry.maxNumRetry (6) times

Fixes #5011
  • Loading branch information
robwalch committed Feb 22, 2023
1 parent 75c8eff commit 2f43728
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
17 changes: 13 additions & 4 deletions src/controller/base-stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import type {
KeyLoadedData,
MediaAttachingData,
BufferFlushingData,
LevelSwitchingData,
ManifestLoadedData,
} from '../types/events';
import type { FragmentTracker } from './fragment-tracker';
Expand Down Expand Up @@ -356,7 +355,6 @@ export default class BaseStreamController
// if we're here we probably needed to backtrack or are waiting for more parts
return;
}
level.fragmentError = 0;
const state = this.state;
if (this.fragContextChanged(frag)) {
if (
Expand Down Expand Up @@ -1521,10 +1519,21 @@ export default class BaseStreamController
},
false
);
if (!parsed) {
this.warn(
if (parsed) {
level.fragmentError = 0;
} else {
const error = new Error(
`Found no media in fragment ${frag.sn} of level ${level.id} resetting transmuxer to fallback to playlist timing`
);
this.warn(error.message);
this.hls.trigger(Events.ERROR, {
type: ErrorTypes.MEDIA_ERROR,
details: ErrorDetails.FRAG_PARSING_ERROR,
fatal: false,
error,
frag,
reason: `Found no media in msn ${frag.sn} of level "${level.url}"`,
});
this.resetTransmuxer();
}
this.state = State.PARSED;
Expand Down
3 changes: 1 addition & 2 deletions src/controller/error-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ export default class ErrorController {
case ErrorDetails.FRAG_PARSING_ERROR:
case ErrorDetails.FRAG_DECRYPT_ERROR: {
const levelIndex = this.getVariantLevelIndex(data.frag);
// Do not retry level. Escalate to fatal if switching levels fails.
data.levelRetry = false;
// Switch level if possible, otherwise allow retry count to reach max error retries
this.levelSwitch(data, levelIndex);
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/controller/level-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ export default class LevelController extends BasePlaylistController {
if (frag !== undefined && frag.type === PlaylistLevelType.MAIN) {
const level = this._levels[frag.level];
if (level !== undefined) {
level.fragmentError = 0;
level.loadError = 0;
}
}
Expand Down

0 comments on commit 2f43728

Please sign in to comment.