hls.js 1.5.14-0.canary.10518 → 1.5.14-0.canary.10524

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.mjs CHANGED
@@ -421,7 +421,7 @@ function enableLogs(debugConfig, context, id) {
421
421
  // Some browsers don't allow to use bind on console object anyway
422
422
  // fallback to default if needed
423
423
  try {
424
- newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.14-0.canary.10518"}`);
424
+ newLogger.log(`Debug logs enabled for "${context}" in hls.js version ${"1.5.14-0.canary.10524"}`);
425
425
  } catch (e) {
426
426
  /* log fn threw an exception. All logger methods are no-ops. */
427
427
  return createLogger();
@@ -11033,7 +11033,7 @@ function concatUint8Arrays(chunks, dataLength) {
11033
11033
  return result;
11034
11034
  }
11035
11035
 
11036
- const version = "1.5.14-0.canary.10518";
11036
+ const version = "1.5.14-0.canary.10524";
11037
11037
 
11038
11038
  // ensure the worker ends up in the bundle
11039
11039
  // If the worker should not be included this gets aliased to empty.js
@@ -11330,7 +11330,11 @@ class BaseAudioDemuxer {
11330
11330
  textTrack: dummyTrack()
11331
11331
  };
11332
11332
  }
11333
- destroy() {}
11333
+ destroy() {
11334
+ this.cachedData = null;
11335
+ // @ts-ignore
11336
+ this._audioTrack = this._id3Track = undefined;
11337
+ }
11334
11338
  }
11335
11339
 
11336
11340
  /**
@@ -11931,7 +11935,12 @@ class MP4Demuxer {
11931
11935
  demuxSampleAes(data, keyData, timeOffset) {
11932
11936
  return Promise.reject(new Error('The MP4 demuxer does not support SAMPLE-AES decryption'));
11933
11937
  }
11934
- destroy() {}
11938
+ destroy() {
11939
+ // @ts-ignore
11940
+ this.config = null;
11941
+ this.remainderData = null;
11942
+ this.videoTrack = this.audioTrack = this.id3Track = this.txtTrack = undefined;
11943
+ }
11935
11944
  }
11936
11945
 
11937
11946
  const getAudioBSID = (data, offset) => {
@@ -12073,14 +12082,13 @@ class BaseVideoParser {
12073
12082
  constructor() {
12074
12083
  this.VideoSample = null;
12075
12084
  }
12076
- createVideoSample(key, pts, dts, debug) {
12085
+ createVideoSample(key, pts, dts) {
12077
12086
  return {
12078
12087
  key,
12079
12088
  frame: false,
12080
12089
  pts,
12081
12090
  dts,
12082
12091
  units: [],
12083
- debug,
12084
12092
  length: 0
12085
12093
  };
12086
12094
  }
@@ -12116,9 +12124,6 @@ class BaseVideoParser {
12116
12124
  }
12117
12125
  videoTrack.samples.push(VideoSample);
12118
12126
  }
12119
- if (VideoSample.debug.length) {
12120
- logger.log(VideoSample.pts + '/' + VideoSample.dts + ':' + VideoSample.debug);
12121
- }
12122
12127
  }
12123
12128
  parseNALu(track, array, endOfSegment) {
12124
12129
  const len = array.byteLength;
@@ -12369,7 +12374,7 @@ class ExpGolomb {
12369
12374
  }
12370
12375
 
12371
12376
  class AvcVideoParser extends BaseVideoParser {
12372
- parsePES(track, textTrack, pes, endOfSegment, duration) {
12377
+ parsePES(track, textTrack, pes, endOfSegment) {
12373
12378
  const units = this.parseNALu(track, pes.data, endOfSegment);
12374
12379
  let VideoSample = this.VideoSample;
12375
12380
  let push;
@@ -12381,10 +12386,10 @@ class AvcVideoParser extends BaseVideoParser {
12381
12386
  // this helps parsing streams with missing AUD (only do this if AUD never found)
12382
12387
  if (VideoSample && units.length && !track.audFound) {
12383
12388
  this.pushAccessUnit(VideoSample, track);
12384
- VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts, '');
12389
+ VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts);
12385
12390
  }
12386
12391
  units.forEach(unit => {
12387
- var _VideoSample2;
12392
+ var _VideoSample2, _VideoSample3;
12388
12393
  switch (unit.type) {
12389
12394
  // NDR
12390
12395
  case 1:
@@ -12414,7 +12419,7 @@ class AvcVideoParser extends BaseVideoParser {
12414
12419
  }
12415
12420
  }
12416
12421
  if (!VideoSample) {
12417
- VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts, '');
12422
+ VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts);
12418
12423
  }
12419
12424
  VideoSample.frame = true;
12420
12425
  VideoSample.key = iskey;
@@ -12430,7 +12435,7 @@ class AvcVideoParser extends BaseVideoParser {
12430
12435
  VideoSample = this.VideoSample = null;
12431
12436
  }
12432
12437
  if (!VideoSample) {
12433
- VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts, '');
12438
+ VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts);
12434
12439
  }
12435
12440
  VideoSample.key = true;
12436
12441
  VideoSample.frame = true;
@@ -12455,7 +12460,6 @@ class AvcVideoParser extends BaseVideoParser {
12455
12460
  track.height = config.height;
12456
12461
  track.pixelRatio = config.pixelRatio;
12457
12462
  track.sps = [sps];
12458
- track.duration = duration;
12459
12463
  const codecarray = sps.subarray(1, 4);
12460
12464
  let codecstring = 'avc1.';
12461
12465
  for (let i = 0; i < 3; i++) {
@@ -12478,10 +12482,13 @@ class AvcVideoParser extends BaseVideoParser {
12478
12482
  case 9:
12479
12483
  push = true;
12480
12484
  track.audFound = true;
12481
- if (VideoSample) {
12485
+ if ((_VideoSample3 = VideoSample) != null && _VideoSample3.frame) {
12482
12486
  this.pushAccessUnit(VideoSample, track);
12487
+ VideoSample = null;
12488
+ }
12489
+ if (!VideoSample) {
12490
+ VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts);
12483
12491
  }
12484
- VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts, '');
12485
12492
  break;
12486
12493
  // Filler Data
12487
12494
  case 12:
@@ -12489,9 +12496,6 @@ class AvcVideoParser extends BaseVideoParser {
12489
12496
  break;
12490
12497
  default:
12491
12498
  push = false;
12492
- if (VideoSample) {
12493
- VideoSample.debug += 'unknown NAL ' + unit.type + ' ';
12494
- }
12495
12499
  break;
12496
12500
  }
12497
12501
  if (VideoSample && push) {
@@ -12699,7 +12703,7 @@ class HevcVideoParser extends BaseVideoParser {
12699
12703
  super(...args);
12700
12704
  this.initVPS = null;
12701
12705
  }
12702
- parsePES(track, textTrack, pes, endOfSegment, duration) {
12706
+ parsePES(track, textTrack, pes, endOfSegment) {
12703
12707
  const units = this.parseNALu(track, pes.data, endOfSegment);
12704
12708
  let VideoSample = this.VideoSample;
12705
12709
  let push;
@@ -12711,10 +12715,10 @@ class HevcVideoParser extends BaseVideoParser {
12711
12715
  // this helps parsing streams with missing AUD (only do this if AUD never found)
12712
12716
  if (VideoSample && units.length && !track.audFound) {
12713
12717
  this.pushAccessUnit(VideoSample, track);
12714
- VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts, '');
12718
+ VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts);
12715
12719
  }
12716
12720
  units.forEach(unit => {
12717
- var _VideoSample2;
12721
+ var _VideoSample2, _VideoSample3;
12718
12722
  switch (unit.type) {
12719
12723
  // NON-IDR, NON RANDOM ACCESS SLICE
12720
12724
  case 0:
@@ -12728,7 +12732,7 @@ class HevcVideoParser extends BaseVideoParser {
12728
12732
  case 8:
12729
12733
  case 9:
12730
12734
  if (!VideoSample) {
12731
- VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts, '');
12735
+ VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts);
12732
12736
  }
12733
12737
  VideoSample.frame = true;
12734
12738
  push = true;
@@ -12750,7 +12754,7 @@ class HevcVideoParser extends BaseVideoParser {
12750
12754
  }
12751
12755
  }
12752
12756
  if (!VideoSample) {
12753
- VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts, '');
12757
+ VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts);
12754
12758
  }
12755
12759
  VideoSample.key = true;
12756
12760
  VideoSample.frame = true;
@@ -12767,7 +12771,7 @@ class HevcVideoParser extends BaseVideoParser {
12767
12771
  VideoSample = this.VideoSample = null;
12768
12772
  }
12769
12773
  if (!VideoSample) {
12770
- VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts, '');
12774
+ VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts);
12771
12775
  }
12772
12776
  VideoSample.key = true;
12773
12777
  VideoSample.frame = true;
@@ -12806,7 +12810,6 @@ class HevcVideoParser extends BaseVideoParser {
12806
12810
  track.width = config.width;
12807
12811
  track.height = config.height;
12808
12812
  track.pixelRatio = config.pixelRatio;
12809
- track.duration = duration;
12810
12813
  track.codec = config.codecString;
12811
12814
  track.sps = [];
12812
12815
  for (const prop in config.params) {
@@ -12818,7 +12821,7 @@ class HevcVideoParser extends BaseVideoParser {
12818
12821
  }
12819
12822
  }
12820
12823
  if (!VideoSample) {
12821
- VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts, '');
12824
+ VideoSample = this.VideoSample = this.createVideoSample(true, pes.pts, pes.dts);
12822
12825
  }
12823
12826
  VideoSample.key = true;
12824
12827
  break;
@@ -12844,16 +12847,16 @@ class HevcVideoParser extends BaseVideoParser {
12844
12847
  case 35:
12845
12848
  push = true;
12846
12849
  track.audFound = true;
12847
- if (VideoSample) {
12850
+ if ((_VideoSample3 = VideoSample) != null && _VideoSample3.frame) {
12848
12851
  this.pushAccessUnit(VideoSample, track);
12852
+ VideoSample = null;
12853
+ }
12854
+ if (!VideoSample) {
12855
+ VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts);
12849
12856
  }
12850
- VideoSample = this.VideoSample = this.createVideoSample(false, pes.pts, pes.dts, '');
12851
12857
  break;
12852
12858
  default:
12853
12859
  push = false;
12854
- if (VideoSample) {
12855
- VideoSample.debug += 'unknown or irrelevant NAL ' + unit.type + ' ';
12856
- }
12857
12860
  break;
12858
12861
  }
12859
12862
  if (VideoSample && push) {
@@ -13404,7 +13407,6 @@ class TSDemuxer {
13404
13407
  this.pmtParsed = false;
13405
13408
  this.audioCodec = void 0;
13406
13409
  this.videoCodec = void 0;
13407
- this._duration = 0;
13408
13410
  this._pmtId = -1;
13409
13411
  this._videoTrack = void 0;
13410
13412
  this._audioTrack = void 0;
@@ -13489,6 +13491,7 @@ class TSDemuxer {
13489
13491
  this.pmtParsed = false;
13490
13492
  this._pmtId = -1;
13491
13493
  this._videoTrack = TSDemuxer.createTrack('video');
13494
+ this._videoTrack.duration = trackDuration;
13492
13495
  this._audioTrack = TSDemuxer.createTrack('audio', trackDuration);
13493
13496
  this._id3Track = TSDemuxer.createTrack('id3');
13494
13497
  this._txtTrack = TSDemuxer.createTrack('text');
@@ -13499,7 +13502,6 @@ class TSDemuxer {
13499
13502
  this.remainderData = null;
13500
13503
  this.audioCodec = audioCodec;
13501
13504
  this.videoCodec = videoCodec;
13502
- this._duration = trackDuration;
13503
13505
  }
13504
13506
  resetTimeStamp() {}
13505
13507
  resetContiguity() {
@@ -13595,7 +13597,7 @@ class TSDemuxer {
13595
13597
  }
13596
13598
  }
13597
13599
  if (this.videoParser !== null) {
13598
- this.videoParser.parsePES(videoTrack, textTrack, pes, false, this._duration);
13600
+ this.videoParser.parsePES(videoTrack, textTrack, pes, false);
13599
13601
  }
13600
13602
  }
13601
13603
  videoData = {
@@ -13769,7 +13771,7 @@ class TSDemuxer {
13769
13771
  }
13770
13772
  }
13771
13773
  if (this.videoParser !== null) {
13772
- this.videoParser.parsePES(videoTrack, textTrack, pes, true, this._duration);
13774
+ this.videoParser.parsePES(videoTrack, textTrack, pes, true);
13773
13775
  videoTrack.pesData = null;
13774
13776
  }
13775
13777
  } else {
@@ -13836,7 +13838,13 @@ class TSDemuxer {
13836
13838
  });
13837
13839
  }
13838
13840
  destroy() {
13839
- this._duration = 0;
13841
+ if (this.observer) {
13842
+ this.observer.removeAllListeners();
13843
+ }
13844
+ // @ts-ignore
13845
+ this.config = this.logger = this.observer = null;
13846
+ this.aacOverFlow = this.videoParser = this.remainderData = this.sampleAes = null;
13847
+ this._videoTrack = this._audioTrack = this._id3Track = this._txtTrack = undefined;
13840
13848
  }
13841
13849
  parseAACPES(track, pes) {
13842
13850
  let startOffset = 0;