hls.js 1.6.3 → 1.6.4
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 +57 -57
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +57 -57
- 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 +57 -57
- 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 +57 -57
- 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/utils/mp4-tools.ts +55 -55
package/package.json
CHANGED
package/src/utils/mp4-tools.ts
CHANGED
@@ -723,68 +723,68 @@ export function getSampleData(
|
|
723
723
|
const sampleCount = readUint32(trun, 4);
|
724
724
|
const sampleIndex = trackTimes.sampleCount;
|
725
725
|
trackTimes.sampleCount += sampleCount;
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
726
|
+
// Get duration from samples
|
727
|
+
const dataOffsetPresent = trun[3] & 0x01;
|
728
|
+
const firstSampleFlagsPresent = trun[3] & 0x04;
|
729
|
+
const sampleDurationPresent = trun[2] & 0x01;
|
730
|
+
const sampleSizePresent = trun[2] & 0x02;
|
731
|
+
const sampleFlagsPresent = trun[2] & 0x04;
|
732
|
+
const sampleCompositionTimeOffsetPresent = trun[2] & 0x08;
|
733
|
+
let offset = 8;
|
734
|
+
let remaining = sampleCount;
|
735
|
+
if (dataOffsetPresent) {
|
736
|
+
offset += 4;
|
737
|
+
}
|
738
|
+
if (firstSampleFlagsPresent && sampleCount) {
|
739
|
+
const isNonSyncSample = trun[offset + 1] & 0x01;
|
740
|
+
if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
|
741
|
+
trackTimes.keyFrameIndex = sampleIndex;
|
742
|
+
}
|
743
|
+
offset += 4;
|
744
|
+
if (sampleDurationPresent) {
|
745
|
+
sampleDuration = readUint32(trun, offset);
|
736
746
|
offset += 4;
|
747
|
+
} else {
|
748
|
+
sampleDuration = defaultSampleDuration;
|
737
749
|
}
|
738
|
-
if (
|
739
|
-
const isNonSyncSample = trun[offset + 1] & 0x01;
|
740
|
-
if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
|
741
|
-
trackTimes.keyFrameIndex = sampleIndex;
|
742
|
-
}
|
750
|
+
if (sampleSizePresent) {
|
743
751
|
offset += 4;
|
744
|
-
if (sampleDurationPresent) {
|
745
|
-
sampleDuration = readUint32(trun, offset);
|
746
|
-
offset += 4;
|
747
|
-
} else {
|
748
|
-
sampleDuration = defaultSampleDuration;
|
749
|
-
}
|
750
|
-
if (sampleSizePresent) {
|
751
|
-
offset += 4;
|
752
|
-
}
|
753
|
-
if (sampleCompositionTimeOffsetPresent) {
|
754
|
-
offset += 4;
|
755
|
-
}
|
756
|
-
sampleDTS += sampleDuration;
|
757
|
-
rawDuration += sampleDuration;
|
758
|
-
remaining--;
|
759
752
|
}
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
753
|
+
if (sampleCompositionTimeOffsetPresent) {
|
754
|
+
offset += 4;
|
755
|
+
}
|
756
|
+
sampleDTS += sampleDuration;
|
757
|
+
rawDuration += sampleDuration;
|
758
|
+
remaining--;
|
759
|
+
}
|
760
|
+
while (remaining--) {
|
761
|
+
if (sampleDurationPresent) {
|
762
|
+
sampleDuration = readUint32(trun, offset);
|
763
|
+
offset += 4;
|
764
|
+
} else {
|
765
|
+
sampleDuration = defaultSampleDuration;
|
766
|
+
}
|
767
|
+
if (sampleSizePresent) {
|
768
|
+
offset += 4;
|
769
|
+
}
|
770
|
+
if (sampleFlagsPresent) {
|
771
|
+
const isNonSyncSample = trun[offset + 1] & 0x01;
|
772
|
+
if (!isNonSyncSample) {
|
773
|
+
if (trackTimes.keyFrameIndex === undefined) {
|
774
|
+
trackTimes.keyFrameIndex =
|
775
|
+
trackTimes.sampleCount - (remaining + 1);
|
776
|
+
trackTimes.keyFrameStart = sampleDTS;
|
778
777
|
}
|
779
|
-
offset += 4;
|
780
|
-
}
|
781
|
-
if (sampleCompositionTimeOffsetPresent) {
|
782
|
-
offset += 4;
|
783
778
|
}
|
784
|
-
|
785
|
-
rawDuration += sampleDuration;
|
779
|
+
offset += 4;
|
786
780
|
}
|
787
|
-
|
781
|
+
if (sampleCompositionTimeOffsetPresent) {
|
782
|
+
offset += 4;
|
783
|
+
}
|
784
|
+
sampleDTS += sampleDuration;
|
785
|
+
rawDuration += sampleDuration;
|
786
|
+
}
|
787
|
+
if (!rawDuration && defaultSampleDuration) {
|
788
788
|
rawDuration += defaultSampleDuration * sampleCount;
|
789
789
|
}
|
790
790
|
}
|