hls.js 1.5.9-0.canary.10265 → 1.5.9-0.canary.10268

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -512,7 +512,7 @@ function enableLogs(debugConfig, context, id) {
512
512
  // Some browsers don't allow to use bind on console object anyway
513
513
  // fallback to default if needed
514
514
  try {
515
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.9-0.canary.10265"}`);
515
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.9-0.canary.10268"}`);
516
516
  } catch (e) {
517
517
  /* log fn threw an exception. All logger methods are no-ops. */
518
518
  return createLogger();
@@ -12492,11 +12492,14 @@ class BaseStreamController extends TaskLoop {
12492
12492
  } = this;
12493
12493
  const fragState = fragmentTracker.getState(frag);
12494
12494
  if (fragState === FragmentState.APPENDING) {
12495
- // Lower the buffer size and try again
12495
+ // Lower the max buffer length and try again
12496
12496
  const playlistType = frag.type;
12497
12497
  const bufferedInfo = this.getFwdBufferInfo(this.mediaBuffer, playlistType);
12498
12498
  const minForwardBufferLength = Math.max(frag.duration, bufferedInfo ? bufferedInfo.len : this.config.maxBufferLength);
12499
- if (this.reduceMaxBufferLength(minForwardBufferLength)) {
12499
+ // If backtracking, always remove from the tracker without reducing max buffer length
12500
+ const backtrackFragment = this.backtrackFragment;
12501
+ const backtracked = backtrackFragment ? frag.sn - backtrackFragment.sn : 0;
12502
+ if (backtracked === 1 || this.reduceMaxBufferLength(minForwardBufferLength)) {
12500
12503
  fragmentTracker.removeFragment(frag);
12501
12504
  }
12502
12505
  } else if (((_this$mediaBuffer = this.mediaBuffer) == null ? void 0 : _this$mediaBuffer.buffered.length) === 0) {
@@ -13000,10 +13003,11 @@ class BaseStreamController extends TaskLoop {
13000
13003
  reduceMaxBufferLength(threshold) {
13001
13004
  const config = this.config;
13002
13005
  const minLength = threshold || config.maxBufferLength;
13003
- if (config.maxMaxBufferLength >= minLength) {
13006
+ const reducedLength = config.maxMaxBufferLength / 2;
13007
+ if (reducedLength >= minLength) {
13004
13008
  // reduce max buffer length as it might be too high. we do this to avoid loop flushing ...
13005
- config.maxMaxBufferLength /= 2;
13006
- this.warn(`Reduce max buffer length to ${config.maxMaxBufferLength}s`);
13009
+ config.maxMaxBufferLength = reducedLength;
13010
+ this.warn(`Reduce max buffer length to ${reducedLength}s`);
13007
13011
  return true;
13008
13012
  }
13009
13013
  return false;
@@ -20376,7 +20380,7 @@ class Hls {
20376
20380
  * Get the video-dev/hls.js package version.
20377
20381
  */
20378
20382
  static get version() {
20379
- return "1.5.9-0.canary.10265";
20383
+ return "1.5.9-0.canary.10268";
20380
20384
  }
20381
20385
 
20382
20386
  /**