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.
@@ -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.3"}`);
526
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.6.4"}`);
527
527
  } catch (e) {
528
528
  /* log fn threw an exception. All logger methods are no-ops. */
529
529
  return createLogger();
@@ -1790,67 +1790,67 @@ function getSampleData(data, initData, logger) {
1790
1790
  const sampleCount = readUint32(trun, 4);
1791
1791
  const sampleIndex = trackTimes.sampleCount;
1792
1792
  trackTimes.sampleCount += sampleCount;
1793
- if (track.type === ElementaryStreamTypes.VIDEO) {
1794
- const dataOffsetPresent = trun[3] & 0x01;
1795
- const firstSampleFlagsPresent = trun[3] & 0x04;
1796
- const sampleDurationPresent = trun[2] & 0x01;
1797
- const sampleSizePresent = trun[2] & 0x02;
1798
- const sampleFlagsPresent = trun[2] & 0x04;
1799
- const sampleCompositionTimeOffsetPresent = trun[2] & 0x08;
1800
- let offset = 8;
1801
- let remaining = sampleCount;
1802
- if (dataOffsetPresent) {
1793
+ // Get duration from samples
1794
+ const dataOffsetPresent = trun[3] & 0x01;
1795
+ const firstSampleFlagsPresent = trun[3] & 0x04;
1796
+ const sampleDurationPresent = trun[2] & 0x01;
1797
+ const sampleSizePresent = trun[2] & 0x02;
1798
+ const sampleFlagsPresent = trun[2] & 0x04;
1799
+ const sampleCompositionTimeOffsetPresent = trun[2] & 0x08;
1800
+ let offset = 8;
1801
+ let remaining = sampleCount;
1802
+ if (dataOffsetPresent) {
1803
+ offset += 4;
1804
+ }
1805
+ if (firstSampleFlagsPresent && sampleCount) {
1806
+ const isNonSyncSample = trun[offset + 1] & 0x01;
1807
+ if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
1808
+ trackTimes.keyFrameIndex = sampleIndex;
1809
+ }
1810
+ offset += 4;
1811
+ if (sampleDurationPresent) {
1812
+ sampleDuration = readUint32(trun, offset);
1803
1813
  offset += 4;
1814
+ } else {
1815
+ sampleDuration = defaultSampleDuration;
1804
1816
  }
1805
- if (firstSampleFlagsPresent && sampleCount) {
1806
- const isNonSyncSample = trun[offset + 1] & 0x01;
1807
- if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
1808
- trackTimes.keyFrameIndex = sampleIndex;
1809
- }
1817
+ if (sampleSizePresent) {
1810
1818
  offset += 4;
1811
- if (sampleDurationPresent) {
1812
- sampleDuration = readUint32(trun, offset);
1813
- offset += 4;
1814
- } else {
1815
- sampleDuration = defaultSampleDuration;
1816
- }
1817
- if (sampleSizePresent) {
1818
- offset += 4;
1819
- }
1820
- if (sampleCompositionTimeOffsetPresent) {
1821
- offset += 4;
1822
- }
1823
- sampleDTS += sampleDuration;
1824
- rawDuration += sampleDuration;
1825
- remaining--;
1826
- }
1827
- while (remaining--) {
1828
- if (sampleDurationPresent) {
1829
- sampleDuration = readUint32(trun, offset);
1830
- offset += 4;
1831
- } else {
1832
- sampleDuration = defaultSampleDuration;
1833
- }
1834
- if (sampleSizePresent) {
1835
- offset += 4;
1836
- }
1837
- if (sampleFlagsPresent) {
1838
- const isNonSyncSample = trun[offset + 1] & 0x01;
1839
- if (!isNonSyncSample) {
1840
- if (trackTimes.keyFrameIndex === undefined) {
1841
- trackTimes.keyFrameIndex = trackTimes.sampleCount - (remaining + 1);
1842
- trackTimes.keyFrameStart = sampleDTS;
1843
- }
1819
+ }
1820
+ if (sampleCompositionTimeOffsetPresent) {
1821
+ offset += 4;
1822
+ }
1823
+ sampleDTS += sampleDuration;
1824
+ rawDuration += sampleDuration;
1825
+ remaining--;
1826
+ }
1827
+ while (remaining--) {
1828
+ if (sampleDurationPresent) {
1829
+ sampleDuration = readUint32(trun, offset);
1830
+ offset += 4;
1831
+ } else {
1832
+ sampleDuration = defaultSampleDuration;
1833
+ }
1834
+ if (sampleSizePresent) {
1835
+ offset += 4;
1836
+ }
1837
+ if (sampleFlagsPresent) {
1838
+ const isNonSyncSample = trun[offset + 1] & 0x01;
1839
+ if (!isNonSyncSample) {
1840
+ if (trackTimes.keyFrameIndex === undefined) {
1841
+ trackTimes.keyFrameIndex = trackTimes.sampleCount - (remaining + 1);
1842
+ trackTimes.keyFrameStart = sampleDTS;
1844
1843
  }
1845
- offset += 4;
1846
- }
1847
- if (sampleCompositionTimeOffsetPresent) {
1848
- offset += 4;
1849
1844
  }
1850
- sampleDTS += sampleDuration;
1851
- rawDuration += sampleDuration;
1845
+ offset += 4;
1852
1846
  }
1853
- } else {
1847
+ if (sampleCompositionTimeOffsetPresent) {
1848
+ offset += 4;
1849
+ }
1850
+ sampleDTS += sampleDuration;
1851
+ rawDuration += sampleDuration;
1852
+ }
1853
+ if (!rawDuration && defaultSampleDuration) {
1854
1854
  rawDuration += defaultSampleDuration * sampleCount;
1855
1855
  }
1856
1856
  }
@@ -19897,7 +19897,7 @@ function assignTrackIdsByGroup(tracks) {
19897
19897
  });
19898
19898
  }
19899
19899
 
19900
- const version = "1.6.3";
19900
+ const version = "1.6.4";
19901
19901
 
19902
19902
  // ensure the worker ends up in the bundle
19903
19903
  // If the worker should not be included this gets aliased to empty.js