@give-tech/ec-player 0.0.1-beta.23 → 0.0.1-beta.25

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/index.js CHANGED
@@ -2228,7 +2228,14 @@ class HLSPlayer extends BasePlayer {
2228
2228
  return null;
2229
2229
  }
2230
2230
  const data = sample.data;
2231
- const hasStartCode = data.length >= 4 && data[0] === 0 && data[1] === 0 && (data[2] === 1 || data[2] === 0 && data[3] === 1);
2231
+ const looksLikeStartCode = data.length >= 4 && data[0] === 0 && data[1] === 0 && (data[2] === 1 || data[2] === 0 && data[3] === 1);
2232
+ let hasStartCode = looksLikeStartCode;
2233
+ if (looksLikeStartCode) {
2234
+ const possibleAvccLength = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
2235
+ if (possibleAvccLength > 0 && possibleAvccLength + 4 === data.length) {
2236
+ hasStartCode = false;
2237
+ }
2238
+ }
2232
2239
  if (hasStartCode) {
2233
2240
  const nalType2 = this._isHevc ? sample.isSync ? HEVC_NAL_TYPE.IDR_W_RADL : 1 : sample.isSync ? 5 : 1;
2234
2241
  return decoder.decode({