hls.js 1.5.9-0.canary.10179 → 1.5.9-0.canary.10182

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
@@ -637,7 +637,7 @@
637
637
  // Some browsers don't allow to use bind on console object anyway
638
638
  // fallback to default if needed
639
639
  try {
640
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.9-0.canary.10179");
640
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.9-0.canary.10182");
641
641
  } catch (e) {
642
642
  /* log fn threw an exception. All logger methods are no-ops. */
643
643
  return createLogger();
@@ -12149,20 +12149,6 @@
12149
12149
  length: 0
12150
12150
  };
12151
12151
  };
12152
- _proto.getLastNalUnit = function getLastNalUnit(samples) {
12153
- var _VideoSample;
12154
- var VideoSample = this.VideoSample;
12155
- var lastUnit;
12156
- // try to fallback to previous sample if current one is empty
12157
- if (!VideoSample || VideoSample.units.length === 0) {
12158
- VideoSample = samples[samples.length - 1];
12159
- }
12160
- if ((_VideoSample = VideoSample) != null && _VideoSample.units) {
12161
- var units = VideoSample.units;
12162
- lastUnit = units[units.length - 1];
12163
- }
12164
- return lastUnit;
12165
- };
12166
12152
  _proto.pushAccessUnit = function pushAccessUnit(VideoSample, videoTrack) {
12167
12153
  if (VideoSample.units.length && VideoSample.frame) {
12168
12154
  // if sample does not have PTS/DTS, patch with last sample PTS/DTS
@@ -12185,7 +12171,7 @@
12185
12171
  logger.log(VideoSample.pts + '/' + VideoSample.dts + ':' + VideoSample.debug);
12186
12172
  }
12187
12173
  };
12188
- _proto.parseNALu = function parseNALu(track, array) {
12174
+ _proto.parseNALu = function parseNALu(track, array, last) {
12189
12175
  var len = array.byteLength;
12190
12176
  var state = track.naluState || 0;
12191
12177
  var lastState = state;
@@ -12227,6 +12213,10 @@
12227
12213
  data: array.subarray(lastUnitStart, overflow),
12228
12214
  type: lastUnitType
12229
12215
  };
12216
+ if (track.lastNalu) {
12217
+ units.push(track.lastNalu);
12218
+ track.lastNalu = null;
12219
+ }
12230
12220
  // logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength);
12231
12221
  units.push(unit);
12232
12222
  } else {
@@ -12234,7 +12224,7 @@
12234
12224
  // first check if start code delimiter is overlapping between 2 PES packets,
12235
12225
  // ie it started in last packet (lastState not zero)
12236
12226
  // and ended at the beginning of this PES packet (i <= 4 - lastState)
12237
- var lastUnit = this.getLastNalUnit(track.samples);
12227
+ var lastUnit = track.lastNalu;
12238
12228
  if (lastUnit) {
12239
12229
  if (lastState && i <= 4 - lastState) {
12240
12230
  // start delimiter overlapping between PES packets
@@ -12251,6 +12241,8 @@
12251
12241
  // logger.log('first NALU found with overflow:' + overflow);
12252
12242
  lastUnit.data = appendUint8Array(lastUnit.data, array.subarray(0, overflow));
12253
12243
  lastUnit.state = 0;
12244
+ units.push(lastUnit);
12245
+ track.lastNalu = null;
12254
12246
  }
12255
12247
  }
12256
12248
  }
@@ -12275,15 +12267,21 @@
12275
12267
  type: lastUnitType,
12276
12268
  state: state
12277
12269
  };
12278
- units.push(_unit);
12279
- // logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);
12280
- }
12281
- // no NALu found
12282
- if (units.length === 0) {
12270
+ if (!last) {
12271
+ track.lastNalu = _unit;
12272
+ // logger.log('store NALu to push it on next PES');
12273
+ } else {
12274
+ units.push(_unit);
12275
+ // logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);
12276
+ }
12277
+ } else if (units.length === 0) {
12278
+ // no NALu found
12283
12279
  // append pes.data to previous NAL unit
12284
- var _lastUnit = this.getLastNalUnit(track.samples);
12280
+ var _lastUnit = track.lastNalu;
12285
12281
  if (_lastUnit) {
12286
12282
  _lastUnit.data = appendUint8Array(_lastUnit.data, array);
12283
+ units.push(_lastUnit);
12284
+ track.lastNalu = null;
12287
12285
  }
12288
12286
  }
12289
12287
  track.naluState = state;
@@ -12455,7 +12453,7 @@
12455
12453
  var _proto = AvcVideoParser.prototype;
12456
12454
  _proto.parsePES = function parsePES(track, textTrack, pes, last, duration) {
12457
12455
  var _this = this;
12458
- var units = this.parseNALu(track, pes.data);
12456
+ var units = this.parseNALu(track, pes.data, last);
12459
12457
  var VideoSample = this.VideoSample;
12460
12458
  var push;
12461
12459
  var spsfound = false;
@@ -12794,7 +12792,7 @@
12794
12792
  var _proto = HevcVideoParser.prototype;
12795
12793
  _proto.parsePES = function parsePES(track, textTrack, pes, last, duration) {
12796
12794
  var _this2 = this;
12797
- var units = this.parseNALu(track, pes.data);
12795
+ var units = this.parseNALu(track, pes.data, last);
12798
12796
  var VideoSample = this.VideoSample;
12799
12797
  var push;
12800
12798
  var spsfound = false;
@@ -30513,7 +30511,7 @@
30513
30511
  * Get the video-dev/hls.js package version.
30514
30512
  */
30515
30513
  function get() {
30516
- return "1.5.9-0.canary.10179";
30514
+ return "1.5.9-0.canary.10182";
30517
30515
  }
30518
30516
  }, {
30519
30517
  key: "Events",