Skip to content

Commit

Permalink
Merge branch 'patch/v1.4.x'
Browse files Browse the repository at this point in the history
* patch/v1.4.x:
  Allow the odd empty segment to be skipped like a gap segment (#5676)
  Use input timescale when remuxing inband captions (#5675)
  • Loading branch information
robwalch committed Jul 18, 2023
2 parents 248f6f8 + 7cde71f commit eb05778
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/controller/base-stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1702,8 +1702,15 @@ export default class BaseStreamController
level.fragmentError = 0;
} else if (this.transmuxer?.error === null) {
const error = new Error(
`Found no media in fragment ${frag.sn} of level ${level.id} resetting transmuxer to fallback to playlist timing`
`Found no media in fragment ${frag.sn} of level ${frag.level} resetting transmuxer to fallback to playlist timing`
);
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.warn(error.message);
this.hls.trigger(Events.ERROR, {
type: ErrorTypes.MEDIA_ERROR,
Expand Down
11 changes: 10 additions & 1 deletion src/controller/error-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,17 @@ export default class ErrorController implements NetworkComponentAPI {
case ErrorDetails.KEY_LOAD_TIMEOUT:
data.errorAction = this.getFragRetryOrSwitchAction(data);
return;
case ErrorDetails.FRAG_GAP:
case ErrorDetails.FRAG_PARSING_ERROR:
// ignore empty segment errors marked as gap
if (data.frag?.gap) {
data.errorAction = {
action: NetworkErrorAction.DoNothing,
flags: ErrorActionFlags.None,
};
return;
}
// falls through
case ErrorDetails.FRAG_GAP:
case ErrorDetails.FRAG_DECRYPT_ERROR: {
// Switch level if possible, otherwise allow retry count to reach max error retries
data.errorAction = this.getFragRetryOrSwitchAction(data);
Expand Down
2 changes: 1 addition & 1 deletion src/controller/fragment-tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class FragmentTracker implements ComponentAPI {

const fragKey = getFragmentKey(frag);
const fragmentEntity = this.fragments[fragKey];
if (!fragmentEntity) {
if (!fragmentEntity || (fragmentEntity.buffered && frag.gap)) {
return;
}
const isFragHint = !frag.relurl;
Expand Down

0 comments on commit eb05778

Please sign in to comment.