@flow-player/software-decoder-ffmpeg 0.6.1 → 0.6.2

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.
Binary file
@@ -38,12 +38,14 @@ var FfmpegSimdSoftwareDecoder = class {
38
38
  #onFrame;
39
39
  #onError;
40
40
  #acquireFrameBuffers;
41
+ #viewFrames;
41
42
  #pendingTimestamps = [];
42
43
  constructor(module, options) {
43
44
  this.#module = module;
44
45
  this.#onFrame = options.onFrame;
45
46
  this.#onError = options.onError;
46
47
  this.#acquireFrameBuffers = options.acquireFrameBuffers;
48
+ this.#viewFrames = options.viewFrames === true;
47
49
  this.#decoder = this.#createNativeDecoder();
48
50
  }
49
51
  #createNativeDecoder() {
@@ -142,10 +144,10 @@ var FfmpegSimdSoftwareDecoder = class {
142
144
  chromaWidth * chromaHeight,
143
145
  chromaWidth * chromaHeight
144
146
  ];
145
- const pooled = this.#acquireFrameBuffers?.(sizes) ?? null;
146
- const y = this.#copyPlane(yPointer, sizes[0], pooled?.[0]);
147
- const u = this.#copyPlane(uPointer, sizes[1], pooled?.[1]);
148
- const v = this.#copyPlane(vPointer, sizes[2], pooled?.[2]);
147
+ const pooled = this.#viewFrames ? null : this.#acquireFrameBuffers?.(sizes) ?? null;
148
+ const y = this.#planeData(yPointer, sizes[0], pooled?.[0]);
149
+ const u = this.#planeData(uPointer, sizes[1], pooled?.[1]);
150
+ const v = this.#planeData(vPointer, sizes[2], pooled?.[2]);
149
151
  const outputTimestamp = this.#takeOutputTimestamp();
150
152
  this.#onFrame({
151
153
  width,
@@ -160,7 +162,10 @@ var FfmpegSimdSoftwareDecoder = class {
160
162
  ]
161
163
  });
162
164
  }
163
- #copyPlane(pointer, size, destBuffer) {
165
+ #planeData(pointer, size, destBuffer) {
166
+ if (this.#viewFrames) {
167
+ return this.#module.HEAPU8.subarray(pointer, pointer + size);
168
+ }
164
169
  const output = destBuffer && destBuffer.byteLength === size ? new Uint8Array(destBuffer) : new Uint8Array(size);
165
170
  output.set(this.#module.HEAPU8.subarray(pointer, pointer + size));
166
171
  return output;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flow-player/software-decoder-ffmpeg",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "FFmpeg (ffdecoder) WASM software decode backend for @flow-player/browser-runtime: prebuilt adapter + decode worker, drop-in HEVC software decoding.",
5
5
  "keywords": [
6
6
  "esm",
@@ -34,6 +34,6 @@
34
34
  "tag": "latest"
35
35
  },
36
36
  "dependencies": {
37
- "@flow-player/browser-runtime": "^0.6.1"
37
+ "@flow-player/browser-runtime": "^0.6.2"
38
38
  }
39
39
  }