hls.js 1.6.1-0.canary.11106 → 1.6.1-0.canary.11108

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.
package/dist/hls.mjs CHANGED
@@ -523,7 +523,7 @@ function enableLogs(debugConfig, context, id) {
523
523
  // Some browsers don't allow to use bind on console object anyway
524
524
  // fallback to default if needed
525
525
  try {
526
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.1-0.canary.11106"}`);
526
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.1-0.canary.11108"}`);
527
527
  } catch (e) {
528
528
  /* log fn threw an exception. All logger methods are no-ops. */
529
529
  return createLogger();
@@ -1502,8 +1502,10 @@ function parseStsd(stsd) {
1502
1502
  {
1503
1503
  // extract profile + compatibility + level out of avcC box
1504
1504
  const avcCBox = findBox(sampleEntriesEnd, ['avcC'])[0];
1505
- codec += '.' + toHex(avcCBox[1]) + toHex(avcCBox[2]) + toHex(avcCBox[3]);
1506
- supplemental = parseSupplementalDoViCodec(codecFourCC === 'avc1' ? 'dva1' : 'dvav', sampleEntriesEnd);
1505
+ if (avcCBox && avcCBox.length > 3) {
1506
+ codec += '.' + toHex(avcCBox[1]) + toHex(avcCBox[2]) + toHex(avcCBox[3]);
1507
+ supplemental = parseSupplementalDoViCodec(codecFourCC === 'avc1' ? 'dva1' : 'dvav', sampleEntriesEnd);
1508
+ }
1507
1509
  break;
1508
1510
  }
1509
1511
  case 'mp4a':
@@ -1554,9 +1556,8 @@ function parseStsd(stsd) {
1554
1556
  case 'hvc1':
1555
1557
  case 'hev1':
1556
1558
  {
1557
- const hvcCBoxes = findBox(sampleEntriesEnd, ['hvcC']);
1558
- if (hvcCBoxes) {
1559
- const hvcCBox = hvcCBoxes[0];
1559
+ const hvcCBox = findBox(sampleEntriesEnd, ['hvcC'])[0];
1560
+ if (hvcCBox && hvcCBox.length > 12) {
1560
1561
  const profileByte = hvcCBox[1];
1561
1562
  const profileSpace = ['', 'A', 'B', 'C'][profileByte >> 6];
1562
1563
  const generalProfileIdc = profileByte & 0x1f;
@@ -1592,34 +1593,38 @@ function parseStsd(stsd) {
1592
1593
  case 'vp09':
1593
1594
  {
1594
1595
  const vpcCBox = findBox(sampleEntriesEnd, ['vpcC'])[0];
1595
- const profile = vpcCBox[4];
1596
- const level = vpcCBox[5];
1597
- const bitDepth = vpcCBox[6] >> 4 & 0x0f;
1598
- codec += '.' + addLeadingZero(profile) + '.' + addLeadingZero(level) + '.' + addLeadingZero(bitDepth);
1596
+ if (vpcCBox && vpcCBox.length > 6) {
1597
+ const profile = vpcCBox[4];
1598
+ const level = vpcCBox[5];
1599
+ const bitDepth = vpcCBox[6] >> 4 & 0x0f;
1600
+ codec += '.' + addLeadingZero(profile) + '.' + addLeadingZero(level) + '.' + addLeadingZero(bitDepth);
1601
+ }
1599
1602
  break;
1600
1603
  }
1601
1604
  case 'av01':
1602
1605
  {
1603
1606
  const av1CBox = findBox(sampleEntriesEnd, ['av1C'])[0];
1604
- const profile = av1CBox[1] >>> 5;
1605
- const level = av1CBox[1] & 0x1f;
1606
- const tierFlag = av1CBox[2] >>> 7 ? 'H' : 'M';
1607
- const highBitDepth = (av1CBox[2] & 0x40) >> 6;
1608
- const twelveBit = (av1CBox[2] & 0x20) >> 5;
1609
- const bitDepth = profile === 2 && highBitDepth ? twelveBit ? 12 : 10 : highBitDepth ? 10 : 8;
1610
- const monochrome = (av1CBox[2] & 0x10) >> 4;
1611
- const chromaSubsamplingX = (av1CBox[2] & 0x08) >> 3;
1612
- const chromaSubsamplingY = (av1CBox[2] & 0x04) >> 2;
1613
- const chromaSamplePosition = av1CBox[2] & 0x03;
1614
- // TODO: parse color_description_present_flag
1615
- // default it to BT.709/limited range for now
1616
- // more info https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax
1617
- const colorPrimaries = 1;
1618
- const transferCharacteristics = 1;
1619
- const matrixCoefficients = 1;
1620
- const videoFullRangeFlag = 0;
1621
- codec += '.' + profile + '.' + addLeadingZero(level) + tierFlag + '.' + addLeadingZero(bitDepth) + '.' + monochrome + '.' + chromaSubsamplingX + chromaSubsamplingY + chromaSamplePosition + '.' + addLeadingZero(colorPrimaries) + '.' + addLeadingZero(transferCharacteristics) + '.' + addLeadingZero(matrixCoefficients) + '.' + videoFullRangeFlag;
1622
- supplemental = parseSupplementalDoViCodec('dav1', sampleEntriesEnd);
1607
+ if (av1CBox && av1CBox.length > 2) {
1608
+ const profile = av1CBox[1] >>> 5;
1609
+ const level = av1CBox[1] & 0x1f;
1610
+ const tierFlag = av1CBox[2] >>> 7 ? 'H' : 'M';
1611
+ const highBitDepth = (av1CBox[2] & 0x40) >> 6;
1612
+ const twelveBit = (av1CBox[2] & 0x20) >> 5;
1613
+ const bitDepth = profile === 2 && highBitDepth ? twelveBit ? 12 : 10 : highBitDepth ? 10 : 8;
1614
+ const monochrome = (av1CBox[2] & 0x10) >> 4;
1615
+ const chromaSubsamplingX = (av1CBox[2] & 0x08) >> 3;
1616
+ const chromaSubsamplingY = (av1CBox[2] & 0x04) >> 2;
1617
+ const chromaSamplePosition = av1CBox[2] & 0x03;
1618
+ // TODO: parse color_description_present_flag
1619
+ // default it to BT.709/limited range for now
1620
+ // more info https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax
1621
+ const colorPrimaries = 1;
1622
+ const transferCharacteristics = 1;
1623
+ const matrixCoefficients = 1;
1624
+ const videoFullRangeFlag = 0;
1625
+ codec += '.' + profile + '.' + addLeadingZero(level) + tierFlag + '.' + addLeadingZero(bitDepth) + '.' + monochrome + '.' + chromaSubsamplingX + chromaSubsamplingY + chromaSamplePosition + '.' + addLeadingZero(colorPrimaries) + '.' + addLeadingZero(transferCharacteristics) + '.' + addLeadingZero(matrixCoefficients) + '.' + videoFullRangeFlag;
1626
+ supplemental = parseSupplementalDoViCodec('dav1', sampleEntriesEnd);
1627
+ }
1623
1628
  break;
1624
1629
  }
1625
1630
  }
@@ -10238,7 +10243,7 @@ function requireEventemitter3 () {
10238
10243
  var eventemitter3Exports = requireEventemitter3();
10239
10244
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
10240
10245
 
10241
- const version = "1.6.1-0.canary.11106";
10246
+ const version = "1.6.1-0.canary.11108";
10242
10247
 
10243
10248
  // ensure the worker ends up in the bundle
10244
10249
  // If the worker should not be included this gets aliased to empty.js
@@ -18938,7 +18943,10 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
18938
18943
  if (buffersAppendedTo.length === 0) {
18939
18944
  this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${frag.type} level: ${frag.level} sn: ${frag.sn}`);
18940
18945
  }
18941
- this.blockBuffers(onUnblocked, buffersAppendedTo);
18946
+ this.blockBuffers(onUnblocked, buffersAppendedTo).catch(error => {
18947
+ this.warn(`Fragment buffered callback ${error}`);
18948
+ this.stepOperationQueue(this.sourceBufferTypes);
18949
+ });
18942
18950
  }
18943
18951
  onFragChanged(event, data) {
18944
18952
  this.trimBuffers();
@@ -19431,9 +19439,16 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
19431
19439
  }
19432
19440
  blockUntilOpen(callback) {
19433
19441
  if (this.isUpdating() || this.isQueued()) {
19434
- this.blockBuffers(callback);
19442
+ this.blockBuffers(callback).catch(error => {
19443
+ this.warn(`SourceBuffer blocked callback ${error}`);
19444
+ this.stepOperationQueue(this.sourceBufferTypes);
19445
+ });
19435
19446
  } else {
19436
- callback();
19447
+ try {
19448
+ callback();
19449
+ } catch (error) {
19450
+ this.warn(`Callback run without blocking ${this.operationQueue} ${error}`);
19451
+ }
19437
19452
  }
19438
19453
  }
19439
19454
  isUpdating() {
@@ -19452,8 +19467,7 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
19452
19467
  blockBuffers(onUnblocked, bufferNames = this.sourceBufferTypes) {
19453
19468
  if (!bufferNames.length) {
19454
19469
  this.log('Blocking operation requested, but no SourceBuffers exist');
19455
- Promise.resolve().then(onUnblocked);
19456
- return;
19470
+ return Promise.resolve().then(onUnblocked);
19457
19471
  }
19458
19472
  const {
19459
19473
  operationQueue
@@ -19465,13 +19479,13 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
19465
19479
  if (audioBlocked) {
19466
19480
  this.unblockAudio();
19467
19481
  }
19468
- Promise.all(blockingOperations).then(result => {
19482
+ return Promise.all(blockingOperations).then(result => {
19469
19483
  if (operationQueue !== this.operationQueue) {
19470
19484
  return;
19471
19485
  }
19472
19486
  // logger.debug(`[buffer-controller]: Blocking operation resolved; unblocking ${buffers} SourceBuffer`);
19473
19487
  onUnblocked();
19474
- this.stepOperationQueue(bufferNames);
19488
+ this.stepOperationQueue(this.sourceBufferTypes);
19475
19489
  });
19476
19490
  }
19477
19491
  stepOperationQueue(bufferNames) {