removeEmu(naluData) {
    let naluClone = naluData;
    let zeroCount = 0;
    let src = 0;
    while (src < naluClone.length) {
      if (zeroCount == 2 && naluClone[src] == 0x03) {
        // 0x00, 0x00, 0x03 pattern detected
        zeroCount = 0;

        // Splice the array and recreate a new one, instead of shifting bytes
        const newArr = [...naluClone];
        newArr.splice(src, 1);
        naluClone = new Uint8Array(newArr);
      } else {
        if (naluClone[src] == 0x00) {
          zeroCount++;
        } else {
          zeroCount = 0;
        }
      }
      src++;
    }
    return naluClone;
  }
Removes H.264 emulation prevention bytes from the byte array.

Note: Remove bytes by shifting will cause Chromium (VDA) to complain
about conformance. Recreating a new array solves it.

@param {!Uint8Array} naluData NALU from which EMUs should be removed.
@return {!Uint8Array} The NALU with the emulation prevention byte removed.