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.light.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();
@@ -2291,67 +2291,67 @@
2291
2291
  var sampleCount = readUint32(trun, 4);
2292
2292
  var sampleIndex = trackTimes.sampleCount;
2293
2293
  trackTimes.sampleCount += sampleCount;
2294
- if (track.type === ElementaryStreamTypes.VIDEO) {
2295
- var dataOffsetPresent = trun[3] & 0x01;
2296
- var firstSampleFlagsPresent = trun[3] & 0x04;
2297
- var sampleDurationPresent = trun[2] & 0x01;
2298
- var sampleSizePresent = trun[2] & 0x02;
2299
- var sampleFlagsPresent = trun[2] & 0x04;
2300
- var sampleCompositionTimeOffsetPresent = trun[2] & 0x08;
2301
- var offset = 8;
2302
- var remaining = sampleCount;
2303
- if (dataOffsetPresent) {
2294
+ // Get duration from samples
2295
+ var dataOffsetPresent = trun[3] & 0x01;
2296
+ var firstSampleFlagsPresent = trun[3] & 0x04;
2297
+ var sampleDurationPresent = trun[2] & 0x01;
2298
+ var sampleSizePresent = trun[2] & 0x02;
2299
+ var sampleFlagsPresent = trun[2] & 0x04;
2300
+ var sampleCompositionTimeOffsetPresent = trun[2] & 0x08;
2301
+ var offset = 8;
2302
+ var remaining = sampleCount;
2303
+ if (dataOffsetPresent) {
2304
+ offset += 4;
2305
+ }
2306
+ if (firstSampleFlagsPresent && sampleCount) {
2307
+ var isNonSyncSample = trun[offset + 1] & 0x01;
2308
+ if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
2309
+ trackTimes.keyFrameIndex = sampleIndex;
2310
+ }
2311
+ offset += 4;
2312
+ if (sampleDurationPresent) {
2313
+ sampleDuration = readUint32(trun, offset);
2304
2314
  offset += 4;
2315
+ } else {
2316
+ sampleDuration = defaultSampleDuration;
2305
2317
  }
2306
- if (firstSampleFlagsPresent && sampleCount) {
2307
- var isNonSyncSample = trun[offset + 1] & 0x01;
2308
- if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
2309
- trackTimes.keyFrameIndex = sampleIndex;
2310
- }
2318
+ if (sampleSizePresent) {
2311
2319
  offset += 4;
2312
- if (sampleDurationPresent) {
2313
- sampleDuration = readUint32(trun, offset);
2314
- offset += 4;
2315
- } else {
2316
- sampleDuration = defaultSampleDuration;
2317
- }
2318
- if (sampleSizePresent) {
2319
- offset += 4;
2320
- }
2321
- if (sampleCompositionTimeOffsetPresent) {
2322
- offset += 4;
2323
- }
2324
- sampleDTS += sampleDuration;
2325
- rawDuration += sampleDuration;
2326
- remaining--;
2327
- }
2328
- while (remaining--) {
2329
- if (sampleDurationPresent) {
2330
- sampleDuration = readUint32(trun, offset);
2331
- offset += 4;
2332
- } else {
2333
- sampleDuration = defaultSampleDuration;
2334
- }
2335
- if (sampleSizePresent) {
2336
- offset += 4;
2337
- }
2338
- if (sampleFlagsPresent) {
2339
- var _isNonSyncSample = trun[offset + 1] & 0x01;
2340
- if (!_isNonSyncSample) {
2341
- if (trackTimes.keyFrameIndex === undefined) {
2342
- trackTimes.keyFrameIndex = trackTimes.sampleCount - (remaining + 1);
2343
- trackTimes.keyFrameStart = sampleDTS;
2344
- }
2320
+ }
2321
+ if (sampleCompositionTimeOffsetPresent) {
2322
+ offset += 4;
2323
+ }
2324
+ sampleDTS += sampleDuration;
2325
+ rawDuration += sampleDuration;
2326
+ remaining--;
2327
+ }
2328
+ while (remaining--) {
2329
+ if (sampleDurationPresent) {
2330
+ sampleDuration = readUint32(trun, offset);
2331
+ offset += 4;
2332
+ } else {
2333
+ sampleDuration = defaultSampleDuration;
2334
+ }
2335
+ if (sampleSizePresent) {
2336
+ offset += 4;
2337
+ }
2338
+ if (sampleFlagsPresent) {
2339
+ var _isNonSyncSample = trun[offset + 1] & 0x01;
2340
+ if (!_isNonSyncSample) {
2341
+ if (trackTimes.keyFrameIndex === undefined) {
2342
+ trackTimes.keyFrameIndex = trackTimes.sampleCount - (remaining + 1);
2343
+ trackTimes.keyFrameStart = sampleDTS;
2345
2344
  }
2346
- offset += 4;
2347
- }
2348
- if (sampleCompositionTimeOffsetPresent) {
2349
- offset += 4;
2350
2345
  }
2351
- sampleDTS += sampleDuration;
2352
- rawDuration += sampleDuration;
2346
+ offset += 4;
2353
2347
  }
2354
- } else {
2348
+ if (sampleCompositionTimeOffsetPresent) {
2349
+ offset += 4;
2350
+ }
2351
+ sampleDTS += sampleDuration;
2352
+ rawDuration += sampleDuration;
2353
+ }
2354
+ if (!rawDuration && defaultSampleDuration) {
2355
2355
  rawDuration += defaultSampleDuration * sampleCount;
2356
2356
  }
2357
2357
  }
@@ -20524,7 +20524,7 @@
20524
20524
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
20525
20525
  }
20526
20526
 
20527
- var version = "1.6.3";
20527
+ var version = "1.6.4";
20528
20528
 
20529
20529
  // ensure the worker ends up in the bundle
20530
20530
  // If the worker should not be included this gets aliased to empty.js