hls.js 1.5.9-0.canary.10181 → 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.light.js CHANGED
@@ -606,7 +606,7 @@
606
606
  // Some browsers don't allow to use bind on console object anyway
607
607
  // fallback to default if needed
608
608
  try {
609
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.9-0.canary.10181");
609
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.9-0.canary.10182");
610
610
  } catch (e) {
611
611
  /* log fn threw an exception. All logger methods are no-ops. */
612
612
  return createLogger();
@@ -14791,20 +14791,6 @@
14791
14791
  length: 0
14792
14792
  };
14793
14793
  };
14794
- _proto.getLastNalUnit = function getLastNalUnit(samples) {
14795
- var _VideoSample;
14796
- var VideoSample = this.VideoSample;
14797
- var lastUnit;
14798
- // try to fallback to previous sample if current one is empty
14799
- if (!VideoSample || VideoSample.units.length === 0) {
14800
- VideoSample = samples[samples.length - 1];
14801
- }
14802
- if ((_VideoSample = VideoSample) != null && _VideoSample.units) {
14803
- var units = VideoSample.units;
14804
- lastUnit = units[units.length - 1];
14805
- }
14806
- return lastUnit;
14807
- };
14808
14794
  _proto.pushAccessUnit = function pushAccessUnit(VideoSample, videoTrack) {
14809
14795
  if (VideoSample.units.length && VideoSample.frame) {
14810
14796
  // if sample does not have PTS/DTS, patch with last sample PTS/DTS
@@ -14827,7 +14813,7 @@
14827
14813
  logger.log(VideoSample.pts + '/' + VideoSample.dts + ':' + VideoSample.debug);
14828
14814
  }
14829
14815
  };
14830
- _proto.parseNALu = function parseNALu(track, array) {
14816
+ _proto.parseNALu = function parseNALu(track, array, last) {
14831
14817
  var len = array.byteLength;
14832
14818
  var state = track.naluState || 0;
14833
14819
  var lastState = state;
@@ -14869,6 +14855,10 @@
14869
14855
  data: array.subarray(lastUnitStart, overflow),
14870
14856
  type: lastUnitType
14871
14857
  };
14858
+ if (track.lastNalu) {
14859
+ units.push(track.lastNalu);
14860
+ track.lastNalu = null;
14861
+ }
14872
14862
  // logger.log('pushing NALU, type/size:' + unit.type + '/' + unit.data.byteLength);
14873
14863
  units.push(unit);
14874
14864
  } else {
@@ -14876,7 +14866,7 @@
14876
14866
  // first check if start code delimiter is overlapping between 2 PES packets,
14877
14867
  // ie it started in last packet (lastState not zero)
14878
14868
  // and ended at the beginning of this PES packet (i <= 4 - lastState)
14879
- var lastUnit = this.getLastNalUnit(track.samples);
14869
+ var lastUnit = track.lastNalu;
14880
14870
  if (lastUnit) {
14881
14871
  if (lastState && i <= 4 - lastState) {
14882
14872
  // start delimiter overlapping between PES packets
@@ -14893,6 +14883,8 @@
14893
14883
  // logger.log('first NALU found with overflow:' + overflow);
14894
14884
  lastUnit.data = appendUint8Array(lastUnit.data, array.subarray(0, overflow));
14895
14885
  lastUnit.state = 0;
14886
+ units.push(lastUnit);
14887
+ track.lastNalu = null;
14896
14888
  }
14897
14889
  }
14898
14890
  }
@@ -14917,15 +14909,21 @@
14917
14909
  type: lastUnitType,
14918
14910
  state: state
14919
14911
  };
14920
- units.push(_unit);
14921
- // logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);
14922
- }
14923
- // no NALu found
14924
- if (units.length === 0) {
14912
+ if (!last) {
14913
+ track.lastNalu = _unit;
14914
+ // logger.log('store NALu to push it on next PES');
14915
+ } else {
14916
+ units.push(_unit);
14917
+ // logger.log('pushing NALU, type/size/state:' + unit.type + '/' + unit.data.byteLength + '/' + state);
14918
+ }
14919
+ } else if (units.length === 0) {
14920
+ // no NALu found
14925
14921
  // append pes.data to previous NAL unit
14926
- var _lastUnit = this.getLastNalUnit(track.samples);
14922
+ var _lastUnit = track.lastNalu;
14927
14923
  if (_lastUnit) {
14928
14924
  _lastUnit.data = appendUint8Array(_lastUnit.data, array);
14925
+ units.push(_lastUnit);
14926
+ track.lastNalu = null;
14929
14927
  }
14930
14928
  }
14931
14929
  track.naluState = state;
@@ -15097,7 +15095,7 @@
15097
15095
  var _proto = AvcVideoParser.prototype;
15098
15096
  _proto.parsePES = function parsePES(track, textTrack, pes, last, duration) {
15099
15097
  var _this = this;
15100
- var units = this.parseNALu(track, pes.data);
15098
+ var units = this.parseNALu(track, pes.data, last);
15101
15099
  var VideoSample = this.VideoSample;
15102
15100
  var push;
15103
15101
  var spsfound = false;
@@ -21723,7 +21721,7 @@
21723
21721
  * Get the video-dev/hls.js package version.
21724
21722
  */
21725
21723
  function get() {
21726
- return "1.5.9-0.canary.10181";
21724
+ return "1.5.9-0.canary.10182";
21727
21725
  }
21728
21726
  }, {
21729
21727
  key: "Events",