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.
@@ -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
  }
@@ -10317,7 +10322,10 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
10317
10322
  if (buffersAppendedTo.length === 0) {
10318
10323
  this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${frag.type} level: ${frag.level} sn: ${frag.sn}`);
10319
10324
  }
10320
- this.blockBuffers(onUnblocked, buffersAppendedTo);
10325
+ this.blockBuffers(onUnblocked, buffersAppendedTo).catch(error => {
10326
+ this.warn(`Fragment buffered callback ${error}`);
10327
+ this.stepOperationQueue(this.sourceBufferTypes);
10328
+ });
10321
10329
  }
10322
10330
  onFragChanged(event, data) {
10323
10331
  this.trimBuffers();
@@ -10810,9 +10818,16 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
10810
10818
  }
10811
10819
  blockUntilOpen(callback) {
10812
10820
  if (this.isUpdating() || this.isQueued()) {
10813
- this.blockBuffers(callback);
10821
+ this.blockBuffers(callback).catch(error => {
10822
+ this.warn(`SourceBuffer blocked callback ${error}`);
10823
+ this.stepOperationQueue(this.sourceBufferTypes);
10824
+ });
10814
10825
  } else {
10815
- callback();
10826
+ try {
10827
+ callback();
10828
+ } catch (error) {
10829
+ this.warn(`Callback run without blocking ${this.operationQueue} ${error}`);
10830
+ }
10816
10831
  }
10817
10832
  }
10818
10833
  isUpdating() {
@@ -10831,8 +10846,7 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
10831
10846
  blockBuffers(onUnblocked, bufferNames = this.sourceBufferTypes) {
10832
10847
  if (!bufferNames.length) {
10833
10848
  this.log('Blocking operation requested, but no SourceBuffers exist');
10834
- Promise.resolve().then(onUnblocked);
10835
- return;
10849
+ return Promise.resolve().then(onUnblocked);
10836
10850
  }
10837
10851
  const {
10838
10852
  operationQueue
@@ -10844,13 +10858,13 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => key === 'initSeg
10844
10858
  if (audioBlocked) {
10845
10859
  this.unblockAudio();
10846
10860
  }
10847
- Promise.all(blockingOperations).then(result => {
10861
+ return Promise.all(blockingOperations).then(result => {
10848
10862
  if (operationQueue !== this.operationQueue) {
10849
10863
  return;
10850
10864
  }
10851
10865
  // logger.debug(`[buffer-controller]: Blocking operation resolved; unblocking ${buffers} SourceBuffer`);
10852
10866
  onUnblocked();
10853
- this.stepOperationQueue(bufferNames);
10867
+ this.stepOperationQueue(this.sourceBufferTypes);
10854
10868
  });
10855
10869
  }
10856
10870
  stepOperationQueue(bufferNames) {
@@ -19793,7 +19807,7 @@ function assignTrackIdsByGroup(tracks) {
19793
19807
  });
19794
19808
  }
19795
19809
 
19796
- const version = "1.6.1-0.canary.11106";
19810
+ const version = "1.6.1-0.canary.11108";
19797
19811
 
19798
19812
  // ensure the worker ends up in the bundle
19799
19813
  // If the worker should not be included this gets aliased to empty.js