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 CHANGED
@@ -1165,7 +1165,7 @@
1165
1165
  // Some browsers don't allow to use bind on console object anyway
1166
1166
  // fallback to default if needed
1167
1167
  try {
1168
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.3");
1168
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.4");
1169
1169
  } catch (e) {
1170
1170
  /* log fn threw an exception. All logger methods are no-ops. */
1171
1171
  return createLogger();
@@ -2298,67 +2298,67 @@
2298
2298
  var sampleCount = readUint32(trun, 4);
2299
2299
  var sampleIndex = trackTimes.sampleCount;
2300
2300
  trackTimes.sampleCount += sampleCount;
2301
- if (track.type === ElementaryStreamTypes.VIDEO) {
2302
- var dataOffsetPresent = trun[3] & 0x01;
2303
- var firstSampleFlagsPresent = trun[3] & 0x04;
2304
- var sampleDurationPresent = trun[2] & 0x01;
2305
- var sampleSizePresent = trun[2] & 0x02;
2306
- var sampleFlagsPresent = trun[2] & 0x04;
2307
- var sampleCompositionTimeOffsetPresent = trun[2] & 0x08;
2308
- var offset = 8;
2309
- var remaining = sampleCount;
2310
- if (dataOffsetPresent) {
2301
+ // Get duration from samples
2302
+ var dataOffsetPresent = trun[3] & 0x01;
2303
+ var firstSampleFlagsPresent = trun[3] & 0x04;
2304
+ var sampleDurationPresent = trun[2] & 0x01;
2305
+ var sampleSizePresent = trun[2] & 0x02;
2306
+ var sampleFlagsPresent = trun[2] & 0x04;
2307
+ var sampleCompositionTimeOffsetPresent = trun[2] & 0x08;
2308
+ var offset = 8;
2309
+ var remaining = sampleCount;
2310
+ if (dataOffsetPresent) {
2311
+ offset += 4;
2312
+ }
2313
+ if (firstSampleFlagsPresent && sampleCount) {
2314
+ var isNonSyncSample = trun[offset + 1] & 0x01;
2315
+ if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
2316
+ trackTimes.keyFrameIndex = sampleIndex;
2317
+ }
2318
+ offset += 4;
2319
+ if (sampleDurationPresent) {
2320
+ sampleDuration = readUint32(trun, offset);
2311
2321
  offset += 4;
2322
+ } else {
2323
+ sampleDuration = defaultSampleDuration;
2312
2324
  }
2313
- if (firstSampleFlagsPresent && sampleCount) {
2314
- var isNonSyncSample = trun[offset + 1] & 0x01;
2315
- if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
2316
- trackTimes.keyFrameIndex = sampleIndex;
2317
- }
2325
+ if (sampleSizePresent) {
2318
2326
  offset += 4;
2319
- if (sampleDurationPresent) {
2320
- sampleDuration = readUint32(trun, offset);
2321
- offset += 4;
2322
- } else {
2323
- sampleDuration = defaultSampleDuration;
2324
- }
2325
- if (sampleSizePresent) {
2326
- offset += 4;
2327
- }
2328
- if (sampleCompositionTimeOffsetPresent) {
2329
- offset += 4;
2330
- }
2331
- sampleDTS += sampleDuration;
2332
- rawDuration += sampleDuration;
2333
- remaining--;
2334
- }
2335
- while (remaining--) {
2336
- if (sampleDurationPresent) {
2337
- sampleDuration = readUint32(trun, offset);
2338
- offset += 4;
2339
- } else {
2340
- sampleDuration = defaultSampleDuration;
2341
- }
2342
- if (sampleSizePresent) {
2343
- offset += 4;
2344
- }
2345
- if (sampleFlagsPresent) {
2346
- var _isNonSyncSample = trun[offset + 1] & 0x01;
2347
- if (!_isNonSyncSample) {
2348
- if (trackTimes.keyFrameIndex === undefined) {
2349
- trackTimes.keyFrameIndex = trackTimes.sampleCount - (remaining + 1);
2350
- trackTimes.keyFrameStart = sampleDTS;
2351
- }
2327
+ }
2328
+ if (sampleCompositionTimeOffsetPresent) {
2329
+ offset += 4;
2330
+ }
2331
+ sampleDTS += sampleDuration;
2332
+ rawDuration += sampleDuration;
2333
+ remaining--;
2334
+ }
2335
+ while (remaining--) {
2336
+ if (sampleDurationPresent) {
2337
+ sampleDuration = readUint32(trun, offset);
2338
+ offset += 4;
2339
+ } else {
2340
+ sampleDuration = defaultSampleDuration;
2341
+ }
2342
+ if (sampleSizePresent) {
2343
+ offset += 4;
2344
+ }
2345
+ if (sampleFlagsPresent) {
2346
+ var _isNonSyncSample = trun[offset + 1] & 0x01;
2347
+ if (!_isNonSyncSample) {
2348
+ if (trackTimes.keyFrameIndex === undefined) {
2349
+ trackTimes.keyFrameIndex = trackTimes.sampleCount - (remaining + 1);
2350
+ trackTimes.keyFrameStart = sampleDTS;
2352
2351
  }
2353
- offset += 4;
2354
- }
2355
- if (sampleCompositionTimeOffsetPresent) {
2356
- offset += 4;
2357
2352
  }
2358
- sampleDTS += sampleDuration;
2359
- rawDuration += sampleDuration;
2353
+ offset += 4;
2360
2354
  }
2361
- } else {
2355
+ if (sampleCompositionTimeOffsetPresent) {
2356
+ offset += 4;
2357
+ }
2358
+ sampleDTS += sampleDuration;
2359
+ rawDuration += sampleDuration;
2360
+ }
2361
+ if (!rawDuration && defaultSampleDuration) {
2362
2362
  rawDuration += defaultSampleDuration * sampleCount;
2363
2363
  }
2364
2364
  }
@@ -16674,7 +16674,7 @@
16674
16674
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16675
16675
  }
16676
16676
 
16677
- var version = "1.6.3";
16677
+ var version = "1.6.4";
16678
16678
 
16679
16679
  // ensure the worker ends up in the bundle
16680
16680
  // If the worker should not be included this gets aliased to empty.js