hls.js 1.5.7-0.canary.10014 → 1.5.7-0.canary.10016

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.
@@ -418,15 +418,9 @@ export class SubtitleStreamController
418
418
  config.maxBufferHole,
419
419
  );
420
420
  const { end: targetBufferTime, len: bufferLen } = bufferedInfo;
421
-
422
- const mainBufferInfo = this.getFwdBufferInfo(
423
- this.media,
424
- PlaylistLevelType.MAIN,
425
- );
426
421
  const trackDetails = track.details as LevelDetails;
427
422
  const maxBufLen =
428
- this.getMaxBufferLength(mainBufferInfo?.len) +
429
- trackDetails.levelTargetDuration;
423
+ this.hls.maxBufferLength + trackDetails.levelTargetDuration;
430
424
 
431
425
  if (bufferLen > maxBufLen) {
432
426
  return;
@@ -482,14 +476,6 @@ export class SubtitleStreamController
482
476
  }
483
477
  }
484
478
 
485
- protected getMaxBufferLength(mainBufferLength?: number): number {
486
- const maxConfigBuffer = super.getMaxBufferLength();
487
- if (!mainBufferLength) {
488
- return maxConfigBuffer;
489
- }
490
- return Math.max(maxConfigBuffer, mainBufferLength);
491
- }
492
-
493
479
  protected loadFragment(
494
480
  frag: Fragment,
495
481
  level: Level,
package/src/hls.ts CHANGED
@@ -171,8 +171,10 @@ export default class Hls implements HlsEventEmitter {
171
171
  } = config;
172
172
  const errorController = new ConfigErrorController(this);
173
173
  const abrController = (this.abrController = new ConfigAbrController(this));
174
+ // FragmentTracker must be defined before StreamController because the order of event handling is important
175
+ const fragmentTracker = new FragmentTracker(this);
174
176
  const bufferController = (this.bufferController =
175
- new ConfigBufferController(this));
177
+ new ConfigBufferController(this, fragmentTracker));
176
178
  const capLevelController = (this.capLevelController =
177
179
  new ConfigCapLevelController(this));
178
180
 
@@ -189,8 +191,6 @@ export default class Hls implements HlsEventEmitter {
189
191
  this,
190
192
  contentSteering,
191
193
  ));
192
- // FragmentTracker must be defined before StreamController because the order of event handling is important
193
- const fragmentTracker = new FragmentTracker(this);
194
194
  const keyLoader = new KeyLoader(this.config);
195
195
  const streamController = (this.streamController = new StreamController(
196
196
  this,
@@ -802,6 +802,10 @@ export default class Hls implements HlsEventEmitter {
802
802
  return this.streamController.getMainFwdBufferInfo();
803
803
  }
804
804
 
805
+ public get maxBufferLength(): number {
806
+ return this.streamController.maxBufferLength;
807
+ }
808
+
805
809
  /**
806
810
  * Find and select the best matching audio track, making a level switch when a Group change is necessary.
807
811
  * Updates `hls.config.audioPreference`. Returns the selected track, or null when no matching track is found.
@@ -193,7 +193,7 @@ export function getCodecCompatibleName(
193
193
  }
194
194
 
195
195
  export function pickMostCompleteCodecName(
196
- parsedCodec: string,
196
+ parsedCodec: string | undefined,
197
197
  levelCodec: string | undefined,
198
198
  ): string | undefined {
199
199
  // Parsing of mp4a codecs strings in mp4-tools from media is incomplete as of d8c6c7a
@@ -478,7 +478,9 @@ function parseStsd(stsd: Uint8Array): { codec: string; encrypted: boolean } {
478
478
 
479
479
  function skipBERInteger(bytes: Uint8Array, i: number): number {
480
480
  const limit = i + 5;
481
- while (bytes[i++] & 0x80 && i < limit) {}
481
+ while (bytes[i++] & 0x80 && i < limit) {
482
+ /* do nothing */
483
+ }
482
484
  return i;
483
485
  }
484
486