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.js +68 -53
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +68 -53
- package/dist/hls.light.js.map +1 -1
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.min.js.map +1 -1
- package/dist/hls.light.mjs +51 -37
- package/dist/hls.light.mjs.map +1 -1
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +51 -37
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/dist/hls.worker.js.map +1 -1
- package/package.json +1 -1
- package/src/controller/buffer-controller.ts +19 -8
- package/src/utils/mp4-tools.ts +71 -65
package/package.json
CHANGED
@@ -1014,7 +1014,10 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => (key === 'initSe
|
|
1014
1014
|
);
|
1015
1015
|
}
|
1016
1016
|
|
1017
|
-
this.blockBuffers(onUnblocked, buffersAppendedTo)
|
1017
|
+
this.blockBuffers(onUnblocked, buffersAppendedTo).catch((error) => {
|
1018
|
+
this.warn(`Fragment buffered callback ${error}`);
|
1019
|
+
this.stepOperationQueue(this.sourceBufferTypes);
|
1020
|
+
});
|
1018
1021
|
}
|
1019
1022
|
|
1020
1023
|
private onFragChanged(event: Events.FRAG_CHANGED, data: FragChangedData) {
|
@@ -1642,9 +1645,18 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => (key === 'initSe
|
|
1642
1645
|
|
1643
1646
|
private blockUntilOpen(callback: () => void) {
|
1644
1647
|
if (this.isUpdating() || this.isQueued()) {
|
1645
|
-
this.blockBuffers(callback)
|
1648
|
+
this.blockBuffers(callback).catch((error) => {
|
1649
|
+
this.warn(`SourceBuffer blocked callback ${error}`);
|
1650
|
+
this.stepOperationQueue(this.sourceBufferTypes);
|
1651
|
+
});
|
1646
1652
|
} else {
|
1647
|
-
|
1653
|
+
try {
|
1654
|
+
callback();
|
1655
|
+
} catch (error) {
|
1656
|
+
this.warn(
|
1657
|
+
`Callback run without blocking ${this.operationQueue} ${error}`,
|
1658
|
+
);
|
1659
|
+
}
|
1648
1660
|
}
|
1649
1661
|
}
|
1650
1662
|
|
@@ -1668,11 +1680,10 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => (key === 'initSe
|
|
1668
1680
|
private blockBuffers(
|
1669
1681
|
onUnblocked: () => void,
|
1670
1682
|
bufferNames: SourceBufferName[] = this.sourceBufferTypes,
|
1671
|
-
) {
|
1683
|
+
): Promise<void> {
|
1672
1684
|
if (!bufferNames.length) {
|
1673
1685
|
this.log('Blocking operation requested, but no SourceBuffers exist');
|
1674
|
-
Promise.resolve().then(onUnblocked);
|
1675
|
-
return;
|
1686
|
+
return Promise.resolve().then(onUnblocked);
|
1676
1687
|
}
|
1677
1688
|
const { operationQueue } = this;
|
1678
1689
|
|
@@ -1684,13 +1695,13 @@ transfer tracks: ${stringify(transferredTracks, (key, value) => (key === 'initSe
|
|
1684
1695
|
if (audioBlocked) {
|
1685
1696
|
this.unblockAudio();
|
1686
1697
|
}
|
1687
|
-
Promise.all(blockingOperations).then((result) => {
|
1698
|
+
return Promise.all(blockingOperations).then((result) => {
|
1688
1699
|
if (operationQueue !== this.operationQueue) {
|
1689
1700
|
return;
|
1690
1701
|
}
|
1691
1702
|
// logger.debug(`[buffer-controller]: Blocking operation resolved; unblocking ${buffers} SourceBuffer`);
|
1692
1703
|
onUnblocked();
|
1693
|
-
this.stepOperationQueue(
|
1704
|
+
this.stepOperationQueue(this.sourceBufferTypes);
|
1694
1705
|
});
|
1695
1706
|
}
|
1696
1707
|
|
package/src/utils/mp4-tools.ts
CHANGED
@@ -343,11 +343,14 @@ function parseStsd(stsd: Uint8Array): StsdData {
|
|
343
343
|
case 'avc4': {
|
344
344
|
// extract profile + compatibility + level out of avcC box
|
345
345
|
const avcCBox = findBox(sampleEntriesEnd, ['avcC'])[0];
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
346
|
+
if (avcCBox && avcCBox.length > 3) {
|
347
|
+
codec +=
|
348
|
+
'.' + toHex(avcCBox[1]) + toHex(avcCBox[2]) + toHex(avcCBox[3]);
|
349
|
+
supplemental = parseSupplementalDoViCodec(
|
350
|
+
codecFourCC === 'avc1' ? 'dva1' : 'dvav',
|
351
|
+
sampleEntriesEnd,
|
352
|
+
);
|
353
|
+
}
|
351
354
|
break;
|
352
355
|
}
|
353
356
|
case 'mp4a': {
|
@@ -397,9 +400,8 @@ function parseStsd(stsd: Uint8Array): StsdData {
|
|
397
400
|
}
|
398
401
|
case 'hvc1':
|
399
402
|
case 'hev1': {
|
400
|
-
const
|
401
|
-
if (
|
402
|
-
const hvcCBox = hvcCBoxes[0];
|
403
|
+
const hvcCBox = findBox(sampleEntriesEnd, ['hvcC'])[0];
|
404
|
+
if (hvcCBox && hvcCBox.length > 12) {
|
403
405
|
const profileByte = hvcCBox[1];
|
404
406
|
const profileSpace = ['', 'A', 'B', 'C'][profileByte >> 6];
|
405
407
|
const generalProfileIdc = profileByte & 0x1f;
|
@@ -436,67 +438,71 @@ function parseStsd(stsd: Uint8Array): StsdData {
|
|
436
438
|
}
|
437
439
|
case 'vp09': {
|
438
440
|
const vpcCBox = findBox(sampleEntriesEnd, ['vpcC'])[0];
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
441
|
+
if (vpcCBox && vpcCBox.length > 6) {
|
442
|
+
const profile = vpcCBox[4];
|
443
|
+
const level = vpcCBox[5];
|
444
|
+
const bitDepth = (vpcCBox[6] >> 4) & 0x0f;
|
445
|
+
codec +=
|
446
|
+
'.' +
|
447
|
+
addLeadingZero(profile) +
|
448
|
+
'.' +
|
449
|
+
addLeadingZero(level) +
|
450
|
+
'.' +
|
451
|
+
addLeadingZero(bitDepth);
|
452
|
+
}
|
449
453
|
break;
|
450
454
|
}
|
451
455
|
case 'av01': {
|
452
456
|
const av1CBox = findBox(sampleEntriesEnd, ['av1C'])[0];
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
?
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
457
|
+
if (av1CBox && av1CBox.length > 2) {
|
458
|
+
const profile = av1CBox[1] >>> 5;
|
459
|
+
const level = av1CBox[1] & 0x1f;
|
460
|
+
const tierFlag = av1CBox[2] >>> 7 ? 'H' : 'M';
|
461
|
+
const highBitDepth = (av1CBox[2] & 0x40) >> 6;
|
462
|
+
const twelveBit = (av1CBox[2] & 0x20) >> 5;
|
463
|
+
const bitDepth =
|
464
|
+
profile === 2 && highBitDepth
|
465
|
+
? twelveBit
|
466
|
+
? 12
|
467
|
+
: 10
|
468
|
+
: highBitDepth
|
469
|
+
? 10
|
470
|
+
: 8;
|
471
|
+
const monochrome = (av1CBox[2] & 0x10) >> 4;
|
472
|
+
const chromaSubsamplingX = (av1CBox[2] & 0x08) >> 3;
|
473
|
+
const chromaSubsamplingY = (av1CBox[2] & 0x04) >> 2;
|
474
|
+
const chromaSamplePosition = av1CBox[2] & 0x03;
|
475
|
+
// TODO: parse color_description_present_flag
|
476
|
+
// default it to BT.709/limited range for now
|
477
|
+
// more info https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax
|
478
|
+
const colorPrimaries = 1;
|
479
|
+
const transferCharacteristics = 1;
|
480
|
+
const matrixCoefficients = 1;
|
481
|
+
const videoFullRangeFlag = 0;
|
482
|
+
codec +=
|
483
|
+
'.' +
|
484
|
+
profile +
|
485
|
+
'.' +
|
486
|
+
addLeadingZero(level) +
|
487
|
+
tierFlag +
|
488
|
+
'.' +
|
489
|
+
addLeadingZero(bitDepth) +
|
490
|
+
'.' +
|
491
|
+
monochrome +
|
492
|
+
'.' +
|
493
|
+
chromaSubsamplingX +
|
494
|
+
chromaSubsamplingY +
|
495
|
+
chromaSamplePosition +
|
496
|
+
'.' +
|
497
|
+
addLeadingZero(colorPrimaries) +
|
498
|
+
'.' +
|
499
|
+
addLeadingZero(transferCharacteristics) +
|
500
|
+
'.' +
|
501
|
+
addLeadingZero(matrixCoefficients) +
|
502
|
+
'.' +
|
503
|
+
videoFullRangeFlag;
|
504
|
+
supplemental = parseSupplementalDoViCodec('dav1', sampleEntriesEnd);
|
505
|
+
}
|
500
506
|
break;
|
501
507
|
}
|
502
508
|
case 'ac-3':
|