react-native-skia-webgpu-video 0.1.0-beta.3 → 0.1.0

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.
Files changed (81) hide show
  1. package/README.md +48 -43
  2. package/android/BUILD_VALIDATION.md +1 -1
  3. package/android/CMakeLists.txt +3 -2
  4. package/android/cpp/ExportHintSession.cpp +114 -0
  5. package/android/cpp/ExportHintSession.h +35 -0
  6. package/android/cpp/VideoEncoderHostObject.cpp +76 -101
  7. package/android/cpp/VideoEncoderHostObject.h +14 -9
  8. package/android/cpp/VideoFrame.cpp +3 -5
  9. package/android/cpp/cpp-adapter.cpp +7 -4
  10. package/android/src/main/java/com/azzapp/rnskv/GLFrameExtractor.java +3 -9
  11. package/android/src/main/java/com/azzapp/rnskv/VideoCompositionDecoder.java +8 -11
  12. package/android/src/main/java/com/azzapp/rnskv/VideoEncoder.java +68 -28
  13. package/docs/FRAME_PIXEL_FORMAT.md +17 -2
  14. package/docs/MIGRATION.md +1 -1
  15. package/docs/UPSTREAM_NOTES.md +42 -2
  16. package/ios/RNSVColorSpace.h +8 -3
  17. package/lib/module/canvas.js +3 -5
  18. package/lib/module/canvas.js.map +1 -1
  19. package/lib/module/exportFrames.js +8 -10
  20. package/lib/module/exportFrames.js.map +1 -1
  21. package/lib/module/exportTarget.js +183 -40
  22. package/lib/module/exportTarget.js.map +1 -1
  23. package/lib/module/exportVideoComposition.js +78 -35
  24. package/lib/module/exportVideoComposition.js.map +1 -1
  25. package/lib/module/frameInterop.js +323 -82
  26. package/lib/module/frameInterop.js.map +1 -1
  27. package/lib/module/gpu.js +1 -3
  28. package/lib/module/gpu.js.map +1 -1
  29. package/lib/module/gpuDevice.js +12 -0
  30. package/lib/module/gpuDevice.js.map +1 -1
  31. package/lib/module/memory.js +7 -0
  32. package/lib/module/memory.js.map +1 -1
  33. package/lib/module/previewLifecycle.js +2 -1
  34. package/lib/module/previewLifecycle.js.map +1 -1
  35. package/lib/module/videoCompositionPlayer.js +65 -14
  36. package/lib/module/videoCompositionPlayer.js.map +1 -1
  37. package/lib/module/videoFrameImage.js +1 -1
  38. package/lib/module/yuvBlit.js +31 -24
  39. package/lib/module/yuvBlit.js.map +1 -1
  40. package/lib/typescript/src/canvas.d.ts.map +1 -1
  41. package/lib/typescript/src/exportFrames.d.ts +3 -2
  42. package/lib/typescript/src/exportFrames.d.ts.map +1 -1
  43. package/lib/typescript/src/exportTarget.d.ts +53 -14
  44. package/lib/typescript/src/exportTarget.d.ts.map +1 -1
  45. package/lib/typescript/src/exportVideoComposition.d.ts +2 -1
  46. package/lib/typescript/src/exportVideoComposition.d.ts.map +1 -1
  47. package/lib/typescript/src/frameInterop.d.ts +16 -5
  48. package/lib/typescript/src/frameInterop.d.ts.map +1 -1
  49. package/lib/typescript/src/gpu.d.ts.map +1 -1
  50. package/lib/typescript/src/gpuDevice.d.ts +5 -1
  51. package/lib/typescript/src/gpuDevice.d.ts.map +1 -1
  52. package/lib/typescript/src/memory.d.ts +2 -0
  53. package/lib/typescript/src/memory.d.ts.map +1 -1
  54. package/lib/typescript/src/previewLifecycle.d.ts +2 -0
  55. package/lib/typescript/src/previewLifecycle.d.ts.map +1 -1
  56. package/lib/typescript/src/types.d.ts +18 -12
  57. package/lib/typescript/src/types.d.ts.map +1 -1
  58. package/lib/typescript/src/videoCompositionPlayer.d.ts +4 -5
  59. package/lib/typescript/src/videoCompositionPlayer.d.ts.map +1 -1
  60. package/lib/typescript/src/videoFrameImage.d.ts +1 -1
  61. package/lib/typescript/src/yuvBlit.d.ts +16 -14
  62. package/lib/typescript/src/yuvBlit.d.ts.map +1 -1
  63. package/package.json +6 -6
  64. package/patches/react-native-skia+3.10.0.patch +150 -0
  65. package/scripts/skia-canvas-patch.json +22 -258
  66. package/src/canvas.ts +3 -7
  67. package/src/exportFrames.ts +10 -11
  68. package/src/exportTarget.ts +217 -56
  69. package/src/exportVideoComposition.ts +130 -85
  70. package/src/frameInterop.ts +389 -96
  71. package/src/gpu.ts +1 -3
  72. package/src/gpuDevice.ts +26 -1
  73. package/src/memory.ts +6 -0
  74. package/src/previewLifecycle.ts +4 -1
  75. package/src/types.ts +18 -12
  76. package/src/videoCompositionPlayer.ts +76 -23
  77. package/src/videoFrameImage.ts +1 -1
  78. package/src/yuvBlit.ts +46 -31
  79. package/android/cpp/EncoderTargets.cpp +0 -226
  80. package/android/cpp/EncoderTargets.h +0 -70
  81. package/patches/react-native-skia+3.7.1.patch +0 -502
@@ -1,8 +1,9 @@
1
1
  #pragma once
2
2
 
3
- #include "EncoderTargets.h"
3
+ #include "ExportHintSession.h"
4
4
  #include "RNSVHostObject.h"
5
5
  #include "VideoComposition.h"
6
+ #include <android/native_window.h>
6
7
  #include <memory>
7
8
  #include <mutex>
8
9
  #include <fbjni/ByteBuffer.h>
@@ -34,13 +35,17 @@ public:
34
35
 
35
36
  void prepare() const;
36
37
 
37
- void makeGLContextCurrent() const;
38
-
39
38
  void encodeFrameRgba(alias_ref<JByteBuffer> pixels, jint width, jint height,
40
39
  jint bytesPerRow, jdouble time) const;
41
40
 
42
- /** A GL_TEXTURE_2D of the encoder's context, e.g. an imported buffer. */
43
- void encodeTexture(jint texture, jdouble time) const;
41
+ /** The codec's input Surface (an android.view.Surface). */
42
+ local_ref<jobject> getInputSurface() const;
43
+
44
+ /** Before a frame is presented to the input Surface: its time in µs. */
45
+ jlong beginWindowFrame(jdouble time) const;
46
+
47
+ /** Once the frame of beginWindowFrame was presented. */
48
+ void endWindowFrame(jlong timeUs) const;
44
49
 
45
50
  void finishWriting() const;
46
51
 
@@ -62,10 +67,10 @@ public:
62
67
 
63
68
  private:
64
69
  global_ref<VideoEncoder> framesExtractor;
65
- // GPU export: buffers Skia renders into, sampled by the encoder's context.
66
- std::unique_ptr<EncoderTargets> targets;
67
- int width;
68
- int height;
70
+ // GPU export: the codec's input Surface, which WebGPU presents to.
71
+ ANativeWindow* window = nullptr;
72
+ // GPU export: the system's hints, per presented frame.
73
+ std::unique_ptr<ExportHintSession> hints;
69
74
  std::recursive_mutex encoderMutex;
70
75
  bool prepared = false;
71
76
  bool finished = false;
@@ -138,13 +138,11 @@ jsi::Value VideoFrame::toJSInternal(jsi::Runtime& runtime) {
138
138
  if (isHardwareBuffer()) {
139
139
  auto owner = acquireHardwareFrame(getNativeHardwareBufferHandle());
140
140
  // An ImageReader frame is the codec's YUV buffer: its picture is the crop
141
- // rectangle, turned for display when WebGPU samples it.
141
+ // rectangle, turned for display and scaled to the frame's size when
142
+ // WebGPU converts it.
142
143
  const bool decodedImage = owner->image != nullptr;
143
- const bool swapped = owner->rotation == 90 || owner->rotation == 270;
144
144
  const bool valid = decodedImage
145
- ? owner->description.format != AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM &&
146
- (swapped ? owner->cropHeight : owner->cropWidth) == width &&
147
- (swapped ? owner->cropWidth : owner->cropHeight) == height
145
+ ? owner->description.format != AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM
148
146
  : owner->description.format == AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM &&
149
147
  owner->description.width == static_cast<uint32_t>(width) &&
150
148
  owner->description.height == static_cast<uint32_t>(height);
@@ -38,12 +38,16 @@ void install(jsi::Runtime& jsiRuntime) {
38
38
  const bool hardware = NativeHardwareBuffer::isEnabled();
39
39
  info.setProperty(runtime, "decodeTransport", jsi::String::createFromAscii(runtime,
40
40
  hardware ? "ahardwarebuffer-rgba-egl" : "cpu-rgba-readback"));
41
- // Export renders into encoder-lent AHardwareBuffers, sampled by the
42
- // encoder's EGL context; CPU readback stays the fallback.
41
+ // Export renders straight into the codec's input Surface through a
42
+ // WebGPU canvas context; the JS export probes it at setup, and CPU
43
+ // readback stays the fallback. Offered with AHardwareBuffer interop,
44
+ // which also samples decoded frames in place: turning interop off
45
+ // selects the readback export, the reference of the pixel checks.
43
46
  info.setProperty(runtime, "encodeTransport", jsi::String::createFromAscii(runtime,
44
- hardware ? "ahardwarebuffer-egl-sample" : "cpu-rgba-upload"));
47
+ hardware ? "webgpu-native-window" : "cpu-rgba-upload"));
45
48
  info.setProperty(runtime, "exportFallback", jsi::String::createFromAscii(runtime, "cpu-rgba-upload"));
46
49
  info.setProperty(runtime, "gpuDirectExport", hardware);
50
+ info.setProperty(runtime, "zeroCopyEncode", hardware);
47
51
  info.setProperty(runtime, "decodeCpuCopiesBeforeSkia", hardware ? 0 : 1);
48
52
  info.setProperty(runtime, "cpuReadbackDecode", !hardware);
49
53
  info.setProperty(runtime, "ownedFrameTransport", jsi::String::createFromAscii(runtime,
@@ -51,7 +55,6 @@ void install(jsi::Runtime& jsiRuntime) {
51
55
  info.setProperty(runtime, "skiaImportTransport", jsi::String::createFromAscii(runtime,
52
56
  hardware ? "native-buffer-webgpu-blit-snapshot" : "cpu-rgba-scoped-copy-webgpu-upload-snapshot"));
53
57
  info.setProperty(runtime, "zeroCopyDecode", false);
54
- info.setProperty(runtime, "zeroCopyEncode", false);
55
58
  return info;
56
59
  }));
57
60
  auto createVideoPlayer = jsi::Function::createFromHostFunction(
@@ -126,8 +126,8 @@ public class GLFrameExtractor implements SurfaceTexture.OnFrameAvailableListener
126
126
  /**
127
127
  * The Surface the codec renders into. With {@code nativeImages}, on API 29+
128
128
  * with hardware buffers, it is an ImageReader's: frames then keep the codec's
129
- * YUV buffer, cropped and turned by {@code rotation} when WebGPU samples it,
130
- * so they must be wanted at the encoded size.
129
+ * YUV buffer, cropped, turned by {@code rotation} and scaled to the frame's
130
+ * size when WebGPU converts it.
131
131
  */
132
132
  @android.annotation.TargetApi(Build.VERSION_CODES.Q)
133
133
  public Surface surfaceFor(int videoWidth, int videoHeight, int rotation, boolean nativeImages) {
@@ -163,13 +163,7 @@ public class GLFrameExtractor implements SurfaceTexture.OnFrameAvailableListener
163
163
  try {
164
164
  if (Build.VERSION.SDK_INT >= 33) awaitProducer(image);
165
165
  Rect crop = image.getCropRect();
166
- boolean swapped = imageRotation == 90 || imageRotation == 270;
167
- int pictureWidth = swapped ? crop.height() : crop.width();
168
- int pictureHeight = swapped ? crop.width() : crop.height();
169
- if (pictureWidth != width || pictureHeight != height) {
170
- throw new IllegalStateException("Decoded image " + pictureWidth + "x" + pictureHeight
171
- + " does not match the requested " + width + "x" + height);
172
- }
166
+ if (crop.isEmpty()) throw new IllegalStateException("Decoded image has an empty crop");
173
167
  HardwareBuffer buffer = image.getHardwareBuffer();
174
168
  if (buffer == null) throw new IllegalStateException("Decoded image has no hardware buffer");
175
169
  long lease;
@@ -676,7 +676,7 @@ public class VideoCompositionDecoder {
676
676
  try {
677
677
  decoder.prepare();
678
678
  decoder.setSurface(slot.extractor.surfaceFor(decoder.getVideoWidth(),
679
- decoder.getVideoHeight(), decoder.getRotation(), wantsNativeImages(item, decoder)));
679
+ decoder.getVideoHeight(), decoder.getRotation(), wantsNativeImages(decoder)));
680
680
  } catch (IOException | RuntimeException e) {
681
681
  decoder.release();
682
682
  throw e;
@@ -685,17 +685,14 @@ public class VideoCompositionDecoder {
685
685
  }
686
686
 
687
687
  /**
688
- * Hardware frames at the encoded size from an 8-bit SDR track skip the GL
689
- * render pass: the codec writes into ImageReader buffers WebGPU samples.
690
- * A capped or explicit size keeps the GL path, which scales while drawing,
691
- * as does `framePixelFormat: 'rgba'`.
688
+ * Hardware frames from an 8-bit SDR track skip the GL render pass: the
689
+ * codec writes into ImageReader buffers, which WebGPU converts at the
690
+ * frame's size, a capped or explicit one included. `framePixelFormat:
691
+ * 'rgba'` keeps the GL path.
692
692
  */
693
- private boolean wantsNativeImages(VideoComposition.Item item, VideoCompositionItemDecoder decoder) {
694
- if (composition.isRgbaFrames() || !composition.isHardwareBufferEnabled() || !decoder.isEightBitSdr())
695
- return false;
696
- int[] size = FrameSize.of(item.getWidth(), item.getHeight(), item.getMaxLongSide(),
697
- decoder.getVideoWidth(), decoder.getVideoHeight(), 0);
698
- return size[0] == decoder.getVideoWidth() && size[1] == decoder.getVideoHeight();
693
+ private boolean wantsNativeImages(VideoCompositionItemDecoder decoder) {
694
+ return !composition.isRgbaFrames() && composition.isHardwareBufferEnabled()
695
+ && decoder.isEightBitSdr();
699
696
  }
700
697
 
701
698
  private void reportOpenError(Exception e) {
@@ -109,6 +109,9 @@ public class VideoEncoder {
109
109
 
110
110
  private Surface inputSurface;
111
111
 
112
+ // Only for CPU readback frames, created on the first one: the GPU export
113
+ // presents to inputSurface through WebGPU instead, and a window has one
114
+ // producer at a time.
112
115
  private EGLResourcesHolder eglResourcesHolder;
113
116
 
114
117
  private TextureRenderer textureRenderer;
@@ -120,6 +123,7 @@ public class VideoEncoder {
120
123
  private long lastPresentationTimeUs = -1;
121
124
  private long submittedFrames;
122
125
  private long writtenFrames;
126
+ private long windowFrames;
123
127
  private static final int MAX_IN_FLIGHT_FRAMES = 4;
124
128
  private static final long MAX_PENDING_SAMPLE_BYTES = 16L * 1024 * 1024;
125
129
  private long pendingSampleBytes;
@@ -211,14 +215,6 @@ public class VideoEncoder {
211
215
  encoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
212
216
 
213
217
  inputSurface = encoder.createInputSurface();
214
- eglResourcesHolder = EGLResourcesHolder.createWithWindowedSurface(EGL10.EGL_NO_CONTEXT, inputSurface);
215
- eglResourcesHolder.runWithContextCurrent(() -> {
216
- textureRenderer = new TextureRenderer();
217
- int[] textures = new int[1];
218
- GLES20.glGenTextures(1, textures, 0);
219
- uploadTexture = textures[0];
220
- EGLUtils.configureTexture(GLES20.GL_TEXTURE_2D, uploadTexture);
221
- });
222
218
  encoder.start();
223
219
 
224
220
  try {
@@ -264,8 +260,59 @@ public class VideoEncoder {
264
260
  }
265
261
  }
266
262
 
267
- public void makeGLContextCurrent() {
268
- eglResourcesHolder.makeCurrent();
263
+ /** The codec's input Surface, for the GPU export to present to. */
264
+ public Surface getInputSurface() {
265
+ if (inputSurface == null) {
266
+ throw new IllegalStateException("Encoder has not been prepared");
267
+ }
268
+ return inputSurface;
269
+ }
270
+
271
+ /**
272
+ * Before the GPU export presents a frame to the input Surface: waits for
273
+ * room in the bounded queue and returns the frame's presentation time in
274
+ * microseconds, which the caller sets on the window for the buffer it
275
+ * queues next.
276
+ */
277
+ public long beginWindowFrame(double time) {
278
+ if (!Double.isFinite(time) || time < 0) {
279
+ throw new IllegalArgumentException("Invalid encoder timestamp");
280
+ }
281
+ if (encoder == null) {
282
+ throw new IllegalStateException("Encoder has not been prepared");
283
+ }
284
+ if (eglResourcesHolder != null) {
285
+ throw new IllegalStateException("The encoder's input Surface is already drawn by EGL");
286
+ }
287
+ awaitEncoderCapacity();
288
+ if (audioException != null) {
289
+ throw new RuntimeException("Could not encode composition audio", audioException);
290
+ }
291
+ long timeUS = TimeHelpers.secToUs(time);
292
+ if (timeUS <= lastPresentationTimeUs) {
293
+ throw new IllegalArgumentException("Encoder presentation timestamps must increase");
294
+ }
295
+ return timeUS;
296
+ }
297
+
298
+ /** Once the frame of beginWindowFrame was presented. */
299
+ public void endWindowFrame(long timeUS) {
300
+ lastPresentationTimeUs = timeUS;
301
+ submittedFrames++;
302
+ windowFrames++;
303
+ drainEncoder(false);
304
+ }
305
+
306
+ private void ensureGLContext() {
307
+ if (eglResourcesHolder != null) return;
308
+ eglResourcesHolder = EGLResourcesHolder.createWithWindowedSurface(EGL10.EGL_NO_CONTEXT, inputSurface);
309
+ eglResourcesHolder.runWithContextCurrent(() -> {
310
+ textureRenderer = new TextureRenderer();
311
+ int[] textures = new int[1];
312
+ GLES20.glGenTextures(1, textures, 0);
313
+ uploadTexture = textures[0];
314
+ EGLUtils.configureTexture(GLES20.GL_TEXTURE_2D, uploadTexture);
315
+ });
269
316
  }
270
317
 
271
318
  /** Uploads owned pixels into this encoder's private context, without retaining the input buffer. */
@@ -275,9 +322,13 @@ public class VideoEncoder {
275
322
  if (rgba == null || rgba.remaining() < required || !Double.isFinite(time) || time < 0) {
276
323
  throw new IllegalArgumentException("Invalid encoder RGBA frame or timestamp");
277
324
  }
278
- if (encoder == null || eglResourcesHolder == null) {
325
+ if (encoder == null) {
279
326
  throw new IllegalStateException("Encoder has not been prepared");
280
327
  }
328
+ if (windowFrames > 0) {
329
+ throw new IllegalStateException("The encoder's input Surface is already drawn by WebGPU");
330
+ }
331
+ ensureGLContext();
281
332
  awaitEncoderCapacity();
282
333
  ByteBuffer source = rgba.duplicate();
283
334
  if (bytesPerRow != RgbaLayout.bytesPerRow(sourceWidth)) {
@@ -314,23 +365,6 @@ public class VideoEncoder {
314
365
  });
315
366
  }
316
367
 
317
- /**
318
- * Encodes a GL_TEXTURE_2D of this encoder's context: a hardware buffer the
319
- * export rendered into through WebGPU, imported as an EGLImage natively.
320
- * The caller waited for the renderer's fence and keeps the buffer until the
321
- * reads this draw queues are complete.
322
- */
323
- public void encodeTexture(int texture, double time) {
324
- if (texture <= 0 || !Double.isFinite(time) || time < 0) {
325
- throw new IllegalArgumentException("Invalid encoder texture or timestamp");
326
- }
327
- if (encoder == null || eglResourcesHolder == null) {
328
- throw new IllegalStateException("Encoder has not been prepared");
329
- }
330
- awaitEncoderCapacity();
331
- eglResourcesHolder.runWithContextCurrent(() -> encodeTextureCurrent(texture, time));
332
- }
333
-
334
368
  private void awaitEncoderCapacity() {
335
369
  drainEncoder(false);
336
370
  long deadline = SystemClock.uptimeMillis() + 15_000;
@@ -370,6 +404,12 @@ public class VideoEncoder {
370
404
 
371
405
  public void finishWriting() {
372
406
  drainEncoder(true);
407
+ // A canvas context drops a frame it could not acquire a window buffer
408
+ // for, without an error: every presented frame must have come out.
409
+ if (windowFrames > 0 && writtenFrames != submittedFrames) {
410
+ throw new IllegalStateException("The encoder wrote " + writtenFrames + " of the "
411
+ + submittedFrames + " frames presented to its input Surface");
412
+ }
373
413
  if (audioThread != null) {
374
414
  try {
375
415
  audioThread.join(30_000);
@@ -17,7 +17,7 @@ const composition = { duration, items, framePixelFormat: 'yuv' }; // 'auto' | 'y
17
17
 
18
18
  | | iOS | Android |
19
19
  | --- | --- | --- |
20
- | `yuv` | AVAssetReader sort le NV12 du décodeur. La preview l'importe comme texture externe à chaque frame et le convertit en RGB dans une passe de rendu ; l'export le convertit dans une texture par clip | `ImageReader` (pistes 8 bits SDR à leur taille encodée ; les autres restent en `rgba`), converti en RGB par la même passe |
20
+ | `yuv` | AVAssetReader sort le NV12 du décodeur. La preview l'importe comme texture externe à chaque frame et le convertit en RGB dans une passe de rendu ; l'export le convertit dans une texture par clip | `ImageReader` (pistes 8 bits SDR, à toute taille de frame, plafonnée ou explicite comprise ; les autres restent en `rgba`), converti en RGB et mis à la taille de la frame par la même passe |
21
21
  | `rgba` | VideoToolbox convertit en BGRA ; l'export GPU échantillonne l'IOSurface en place, sans copie | Passe OpenGL vers un `AHardwareBuffer` RGBA |
22
22
  | `auto` (défaut) | `yuv` | `yuv` |
23
23
 
@@ -79,7 +79,22 @@ Chaque frame exportée a été relue : la bonne frame source dans tous les cas,
79
79
  | HEVC 1080p 60 → 640×360 | 4,1 s | 8,9 s | 0,9–1,4 s | **0,5 s** |
80
80
  | Montage de 120 clips (suite `full`) | **63,5 s** | 95,9 s | 18,1 s | **14,0 s** |
81
81
 
82
- Sur iOS, l'export en `yuv` importe chaque frame NV12 et la convertit dans une texture, là où le BGRA est lu en place. Ce surcoût d'environ 2 à 4 ms par frame est invisible en 4K, où le décodage domine, mais pèse sur les sorties petites ou les exports longs. Pour un export iOS où la vitesse prime sur la mémoire, `framePixelFormat: 'rgba'` reste le plus rapide.
82
+ Sur iOS, l'export en `yuv` importe chaque frame NV12 et la convertit dans une texture, là où le BGRA est lu en place. Au 21 octobre (beta.3), ce surcoût d'environ 2 à 4 ms par frame pesait sur les sorties petites ou les exports longs.
83
+
84
+ **Mise à jour du 4 novembre 2026 (Skia 3.9.1, même build, deux répétitions) :** l'écart a disparu depuis l'import NV12 en place de la beta.4.
85
+
86
+ | Export iPhone 15 Pro | `yuv` | `rgba` |
87
+ | --- | --- | --- |
88
+ | `long-montage-120-clips` (2 160 images) | **7 692 ms** | 7 778 ms |
89
+ | `shorts-x20-lazy` | **1 298 ms** | 1 354 ms |
90
+ | `montage-all-crossfade-lazy` | 2 191 ms | 2 122 ms |
91
+ | `native-hevc-1080p-rot270` | 737 ms | 728 ms |
92
+ | `encode-h264-copy` | 180 ms | 178 ms |
93
+
94
+ - La conversion coûte environ 0,9 ms de GPU par image sur des sources 4K, mais le décodage NV12 gagne environ 0,8 ms.
95
+ - `rgba` gardait un dernier avantage sur iOS : la conversion des fichiers étiquetés Display P3 ou sRGB. Depuis le 4 novembre, le décodage NV12 la demande aussi à AVFoundation (`TrackNeedsSDRConversion`, `ios/RNSVColorSpace.h`). Sur `render-tagged-p3-flowers`, l'écart `yuv`/`rgba` passe de 26 (moyenne 5,72) à 7 (moyenne 0,82), au niveau des clips Rec.709. Les autres fichiers ne bougent pas.
96
+ - **`rgba` est donc déprécié** : il ne fait plus rien que `yuv` ne fasse aussi bien. Il reste accepté.
97
+ - En aperçu, `rgba` est à éviter : depuis Skia 3.9.1, un aperçu 4K60 en `rgba` sur iPhone 15 Pro garde environ 235 images sur 360, contre 355 en `yuv` (voir la [vérification 3.9.1](../migration/skia-3.9.1/verification.md)).
83
98
 
84
99
  ### Mémoire
85
100
 
package/docs/MIGRATION.md CHANGED
@@ -67,7 +67,7 @@ Audio is implemented on both native platforms, but the device runs so far (3.0.6
67
67
 
68
68
  Set `configureVideoMemory({ maxBytes })` before allocating sessions. The budget covers tracked resources only; codecs and drivers can retain additional memory. A budget rejection does not silently reduce export dimensions.
69
69
 
70
- On Android with the AHardwareBuffer interop (API 29+, 8-bit SDR H.264/HEVC at the encoded size), the codec writes into an `ImageReader`; WebGPU converts, crops and rotates each YUV buffer, imported once, into an independent Graphite snapshot after a checked GPU fence. Exports skip that snapshot: each clip's frame is converted into a texture of its own and sampled in place, as on iOS. Other sources render through the decoder's private EGL context into an RGBA AHardwareBuffer, or, without the interop, read owned RGBA pixels on the CPU and upload them. All of these avoid Skia's image-count raster-upload cache. CPU Java/JSI backing buffers remain accounted until their aliases and ART/Hermes owners are collected. See the [upstream cache notes](UPSTREAM_NOTES.md#android--éviter-le-cache-dimages-raster-du-provider) and the [3.6.1 verification](../migration/skia-3.6.1/verification.md).
70
+ On Android with the AHardwareBuffer interop (API 29+, 8-bit SDR H.264/HEVC), the codec writes into an `ImageReader`; WebGPU converts, crops, rotates and scales each YUV buffer, imported once, to the frame's size (a `maxLongSide` cap or an explicit `resolution` included) in an independent Graphite snapshot after a checked GPU fence. Exports skip that snapshot: each clip's frame is converted into a texture of its own and sampled in place, as on iOS. Other sources render through the decoder's private EGL context into an RGBA AHardwareBuffer, or, without the interop, read owned RGBA pixels on the CPU and upload them. All of these avoid Skia's image-count raster-upload cache. CPU Java/JSI backing buffers remain accounted until their aliases and ART/Hermes owners are collected. See the [upstream cache notes](UPSTREAM_NOTES.md#android--éviter-le-cache-dimages-raster-du-provider) and the [3.6.1 verification](../migration/skia-3.6.1/verification.md).
71
71
 
72
72
  The optional `createFrameProcessor` export factory creates a processor once per export. Its asynchronous `prepareFrame` runs at the requested composition timestamp and its `dispose` must finish all frame readers. Drive animated effects from that timestamp, not an independent display animation loop.
73
73
 
@@ -1,5 +1,34 @@
1
1
  # Points amont à revoir lors d'une mise à jour Skia
2
2
 
3
+ **Mise à jour du 12 novembre 2026 :** **`react-native-skia@3.10.0`** et **`react-native-webgpu@0.21.3`**, sur Dawn/Graphite **158.0.0** (Skia m158, [#4419](https://github.com/wcandillon/react-native-skia/pull/4419)) ; les deux paquets montent ensemble.
4
+ - **Patch :** `RNDawnContext.h` et `JsiSkSurface.h` sont identiques octet pour octet à ceux de la 3.9.2. `JsiSkApi.h` change (ajout de `ShapeBlob`), mais les éditions s'y appliquent telles quelles ; seules ses empreintes changent.
5
+ - **Autres changements amont :** `pendingFrames` exposé par vue sur `SkGraphiteContext` ([#4412](https://github.com/wcandillon/react-native-skia/pull/4412)), rejeu des commandes du recorder sans copies ([#4423](https://github.com/wcandillon/react-native-skia/pull/4423), [#4424](https://github.com/wcandillon/react-native-skia/pull/4424)), `SkShapeBlob` ([#4413](https://github.com/wcandillon/react-native-skia/pull/4413), non utilisé ici).
6
+ - **Vérifié sur l'hôte seulement :** Jest, typecheck, tests du paquet. Pas encore de build ni de mesure sur appareil.
7
+
8
+ **Mise à jour du 9 novembre 2026 :** **`react-native-skia@3.9.2`** et **`react-native-webgpu@0.21.2`**, toujours sur Dawn/Graphite **157.1.0**. Le `main` amont du jour (`cf9240bd6`) ne diffère de la v3.9.2 que par un banc de performance de l'exemple et de la CI ([#4385](https://github.com/wcandillon/react-native-skia/pull/4385)) : le paquet publié est le même.
9
+ - **Patch :** `JsiSkSurface.h` et `JsiSkApi.h` sont identiques octet pour octet à ceux de la 3.9.1. `RNDawnContext.h` change, mais les 8 éditions s'y appliquent telles quelles.
10
+ - **Une ligne ajoutée au patch :** `submitRecordingChecked` marque son snap et son exécution comme travail GPU (`RNSkGpuActivity::Scope`), comme le fait désormais `submitRecording` en amont.
11
+ - La 3.9.2 compile en tâche de fond les pipelines courants et ceux du lancement précédent (`RNSkPipelineWarmup`, [#4398](https://github.com/wcandillon/react-native-skia/pull/4398)).
12
+ - Ce warmup ne compile que si aucun travail GPU n'est marqué, car chaque compilation tient le verrou du device Dawn.
13
+ - Sans le marquage, nos soumissions vérifiées (l'export) passeraient pour un device au repos.
14
+ - **Autres changements amont :** cadence des vues refaite ([#4398](https://github.com/wcandillon/react-native-skia/pull/4398)), le thread principal Android n'attend plus le thread de présentation ([#4395](https://github.com/wcandillon/react-native-skia/pull/4395)), `MakeGPUTextureFromImage` n'attend plus le CPU ([#4401](https://github.com/wcandillon/react-native-skia/pull/4401), non utilisé ici).
15
+ - **WebGPU 0.21.1 et 0.21.2 :** un `null` dans une liste d'emplacements garde son index ([#617](https://github.com/wcandillon/react-native-webgpu/pull/617)), `device.queue` rend toujours le même objet ([#614](https://github.com/wcandillon/react-native-webgpu/pull/614)), pod compatible `use_frameworks!` ([#612](https://github.com/wcandillon/react-native-webgpu/pull/612)).
16
+ - [#4276](https://github.com/wcandillon/react-native-skia/pull/4276) est toujours ouverte : le patch ne rétrécit pas.
17
+
18
+ **Mise à jour du 4 novembre 2026 :** **`react-native-skia@3.9.1`** et **`react-native-webgpu@0.21.0`**, sur Dawn/Graphite **157.1.0** ; les deux paquets montent ensemble.
19
+ - **Patch :** `RNDawnContext.h` et `JsiSkApi.h` changent en amont, mais les 8 éditions s'appliquent telles quelles ; seuls les empreintes et les décalages changent.
20
+ - **Readbacks asynchrones (3.9.0, [#4368](https://github.com/wcandillon/react-native-skia/pull/4368)) :** `canvas.readPixels` renvoie une promesse et ne prend plus de tableau de destination. Le readback CPU de secours de l'export attend donc la lecture avant d'encoder.
21
+ - **Aperçu et 3.9.1 :** la 3.9.1 présente une recording par vsync ([#4386](https://github.com/wcandillon/react-native-skia/pull/4386)).
22
+ - Notre aperçu attendait le GPU sur le thread UI à chaque image et à chaque import (`flush(true)`). Ces attentes portent sur tout le contexte partagé, présentation des vues comprise.
23
+ - Résultat, sans correctif : le 4K60 natif sur iPhone tombait de 60 à ~40 i/s. La 3.9.0 n'est pas touchée (bisection).
24
+ - Corrigé de notre côté : dessin et import soumis sans attente, tampons du décodeur rendus quand le GPU a fini (promesse WebGPU), le tout borné par le budget mémoire.
25
+ - À une prochaine montée, mesurer de nouveau `preview-4k-hevc-60-noread` sur iPhone : c'est le cas qui révèle ces couplages.
26
+ - Détails : [vérification](../migration/skia-3.9.1/verification.md).
27
+
28
+ **Mise à jour du 1er novembre 2026 :** **`react-native-skia@3.8.1`** et **`react-native-webgpu@0.19.2`**, toujours sur Dawn/Graphite 157.0.0. Les trois fichiers patchés sont identiques octet pour octet à ceux de la 3.7.4 : le patch s'applique tel quel, seuls sa version et son nom changent. La 3.8.0 renomme les factories sans alias ([#4323](https://github.com/wcandillon/react-native-skia/pull/4323)) : nous appelons désormais `Skia.Image.MakeFromGPUTexture` (ex-`MakeImageFromGPUTexture`) et `Skia.Image.MakeRaster` (ex-`MakeRasterImage`). Elle retire aussi `SkiaPictureView` ([#4327](https://github.com/wcandillon/react-native-skia/pull/4327)), que la bibliothèque n'utilise pas. Le seul changement natif sur nos chemins vient de la 3.8.1 et de WebGPU 0.19.2 ([#4341](https://github.com/wcandillon/react-native-skia/pull/4341), [WebGPU #595](https://github.com/wcandillon/react-native-webgpu/pull/595)) : sur Android, Dawn garde un seul `VkPipelineCache` par device au lieu d'en créer et détruire un par pipeline compilé. Cela corrige un crash du pilote PowerVR (MediaTek) pendant la compilation des pipelines Graphite. Notre PR [#4276](https://github.com/wcandillon/react-native-skia/pull/4276) est toujours ouverte, et [#4274](https://github.com/wcandillon/react-native-skia/pull/4274) a été fermée (le correctif est entré par #4277) : le patch ne rétrécit pas. Voir la [vérification](../migration/skia-3.8.1/verification.md).
29
+
30
+ **Mise à jour du 23 octobre 2026 :** **`react-native-skia@3.7.4`** et **`react-native-webgpu@0.19.0`**, toujours sur Dawn/Graphite 157.0.0. Le patch local passe de 7 fichiers et 62 éditions à 3 fichiers et 8 éditions. `canvas.dispose()` disparaît : en amont, la surface possède son canvas ([#4278](https://github.com/wcandillon/react-native-skia/pull/4278)) et `surface.dispose()` le détache. Le correctif d'`ImageProvider::Make()` est entré en amont par [#4277](https://github.com/wcandillon/react-native-skia/pull/4277). Restent les soumissions vérifiées, réécrites sur le nouveau `DawnContext::submitRecording(recorder, …)`, et `__rnskvTrimRecorderCache`, réduit à un appel de `trimThreadRecorders`. L'export Android rend désormais directement dans la `Surface` d'entrée du codec par `MakeWebGPUCanvasContextFromNativeWindow` ([WebGPU #588](https://github.com/wcandillon/react-native-webgpu/pull/588)), sans EGL. Voir l'[audit](../migration/skia-3.7.4/upstream-audit.md) et la [vérification](../migration/skia-3.7.4/verification.md).
31
+
3
32
  **Mise à jour du 20 octobre 2026 :** **`react-native-skia@3.7.1`**, toujours avec `react-native-webgpu@0.17.0` et Dawn/Graphite 157.0.0. La 3.7.1 ne contient qu'une correction iOS ([#4273](https://github.com/wcandillon/react-native-skia/pull/4273)) : `SkiaView.mm` présente désormais à la pleine fréquence de l'écran sur les appareils ProMotion. Les sept fichiers modifiés par le patch local sont identiques octet pour octet à ceux de la 3.7.0 : le patch s'applique tel quel, seuls sa version et son nom changent. Nos PR amont [#4274](https://github.com/wcandillon/react-native-skia/pull/4274), [#4275](https://github.com/wcandillon/react-native-skia/pull/4275) et [#4276](https://github.com/wcandillon/react-native-skia/pull/4276) sont encore ouvertes : le patch ne rétrécit pas. Vérifié le 20 octobre sur appareils, en Release : iPhone 15 Pro, tests natifs 50/50 et profil smoke 15/15 (l'app déclare Skia 3.7.1, écran à 120 Hz) ; Pixel 8a, contrôle `interop` 10/10 (erreur maximale par canal de 1, comme en 3.7.0, chemins GPU et readback d'accord à l'export) et smoke 15/15. Les mesures d'export de la 3.7.0 restent la référence : le code d'export ne change pas.
4
33
 
5
34
  **Migration du 19 octobre 2026 :** le code et les dépendances déclarées ciblent désormais **`react-native-skia@3.7.0` / `react-native-webgpu@0.17.0`**, sur Graphite **157.0.0** et **`react-native-webgpu-dawn@157.0.0`** (Skia `chrome/m157`). Les deux paquets doivent monter ensemble : Gradle et le podspec refusent deux Dawn différents. Le patch local garde 61 de ses 62 éditions ; seule tombe l'include `<stdexcept>`, désormais présent en amont. Le Dawn 157 demande trois images FIFO à la swapchain Android, ce qui supprime l'attente du thread principal dans `dequeueBuffer` sur Android 10 ; il garde aussi la robustesse des shaders sur Android, nos WGSL compris. L'[audit](../migration/skia-3.7.0/upstream-audit.md) détaille ces changements ; la [vérification](../migration/skia-3.7.0/verification.md) donne les mesures sur iPhone 15 Pro et Pixel 8a. Après une mise à jour, supprimer le bundle JS généré par Gradle avant de construire un APK de qualification : sa tâche ne voit pas le `node_modules` racine.
@@ -97,6 +126,8 @@ Cette architecture pourrait éviter la lecture CPU de la **sortie composée**. E
97
126
 
98
127
  ## Patch distinct : durée de vie et soumissions vérifiées
99
128
 
129
+ **Depuis 3.7.4**, seules les soumissions vérifiées et la réduction du cache du runtime d'export restent dans le patch : la durée de vie du canvas et la factory d'`ImageProvider` sont corrigées en amont (voir la mise à jour du 23 octobre). La suite décrit l'historique du patch.
130
+
100
131
  Ces quatre protections restent nécessaires en **3.4.4**, puis en **3.6.1**, dont les fichiers patchés sont identiques à ceux de 3.4.4 : l'amont n'a ajouté ni `dispose()` de canvas, ni contrôle d'`insertRecording`, ni garde du snapshot nul, et sa factory d'`ImageProvider` n'a pas changé. Le `dispose()` rebasé remet la surface au `Dispatcher` de son thread créateur, comme le fait désormais le destructeur amont du canvas. Le reste de cette section décrit le patch d'origine.
101
132
 
102
133
  Dans Skia 3.0.3 et encore dans les sources 3.0.6, le wrapper `JsiSkCanvas` peut garder une référence propriétaire à la surface dont il provient. Disposer uniquement le wrapper `SkSurface` ne ferme donc pas cette référence tant que le canvas est encore détenu ; attendre le GC pour les surfaces temporaires est insuffisant pour une fermeture déterministe.
@@ -113,7 +144,7 @@ La [source Skia de ce build](https://chromium.googlesource.com/skia/+/2466dcf393
113
144
 
114
145
  Fichiers inspectables :
115
146
 
116
- - [`patches/react-native-skia+3.6.1.patch`](../patches/react-native-skia+3.6.1.patch) : diff du correctif courant, identique à celui de 3.4.4 ; ceux de 3.4.4 et 3.0.6 sont conservés comme historique.
147
+ - [`patches/react-native-skia+3.10.0.patch`](../patches/react-native-skia+3.10.0.patch) : diff du correctif courant ; ceux des versions précédentes sont conservés comme historique.
117
148
  - [`scripts/skia-canvas-patch.json`](../scripts/skia-canvas-patch.json) : version, empreintes avant/après et substitutions attendues.
118
149
  - [`scripts/apply-skia-canvas-patch.mjs`](../scripts/apply-skia-canvas-patch.mjs) : vérifie tout avant toute écriture, accepte un patch déjà appliqué, refuse un paquet différent.
119
150
 
@@ -179,6 +210,15 @@ Le patch ajoute également une méthode privée `__rnskvTrimRecorderCache` : ell
179
210
 
180
211
  Lors d'une mise à jour amont, vérifier séparément la correction de la factory, l'affinité de thread du Recorder, les erreurs de soumission et une éventuelle API officielle de nettoyage. Ne pas remplacer cette politique limitée par une purge globale à chaque frame.
181
212
 
213
+ ## Piste testée : Graphite échantillonne le YUV du décodeur — 24 octobre 2026
214
+
215
+ Sur Android, l'export convertit chaque buffer YUV de l'`ImageReader` en RGBA (une passe WebGPU par frame), puis Skia échantillonne cette texture. Le Skia Graphite précompilé sait échantillonner un `OpaqueYCbCrAndroid` directement, à travers un sampler YCbCr Vulkan (`DawnTextureInfo::fYcbcrVkDescriptor`, `DawnDescriptorToImmutableSamplerInfo`). Un prototype l'a fait marcher sur le Pixel 8a :
216
+ - RN Skia demande `YCbCrVulkanSamplers` et `StaticSamplers` au device, en plus d'`OpaqueYCbCrAndroidForExternalTexture` ;
217
+ - une méthode `Skia.Image.MakeImageFromYCbCrTexture(texture, hardwareBuffer)` lit le descripteur avec `wgpu::Device::GetAHardwareBufferProperties` et enveloppe la texture de `importSharedTextureMemory` ;
218
+ - l'export ouvre l'accès du buffer à l'import et le ferme quand la frame est libérée ; la frame porte le recadrage et la rotation du buffer, comme une frame `direct`.
219
+
220
+ La passe de conversion disparaît (attente GPU d'une frame 8×4K → 1080 : 2,7 → 1,2 ms), mais la durée des exports ne change pas : une fois l'attente GPU différée et les indices ADPF en place, le bloc codec (décodage 4K et encodage) limite le débit. Les octets exportés changent aussi (reconstruction de la chrominance par le sampler), ce qui demanderait une qualification d'image. Le prototype n'a donc pas été gardé ; il reste à reprendre si un cas devient limité par le GPU (plusieurs couches 4K, GPU plus modeste). Mesures : [vérification 3.7.4](../migration/skia-3.7.4/verification.md#améliorations-du-24-octobre).
221
+
182
222
  ## Référence fournie : `enzomanuelmangano/demos`
183
223
 
184
224
  Le [dépôt de démos](https://github.com/enzomanuelmangano/demos) est utile pour choisir des scènes visuelles : transitions, reflets de shader et interactions pilotées par des valeurs partagées. Le [manifest consulté](https://github.com/enzomanuelmangano/demos/blob/main/package.json) fixe encore Skia 2.6.2 et WebGPU 0.5.14 ; ses patches de compatibilité ne sont donc pas une preuve de compatibilité avec le couple désormais ciblé 3.0.6/0.12.1, ni avec le couple mesuré 3.0.3/0.11.0.
@@ -187,4 +227,4 @@ Les idées retenues pour les futurs adaptateurs sont une transition à progressi
187
227
 
188
228
  ## Procédure de mise à jour
189
229
 
190
- Pour chaque nouvelle version Skia : relever le couple Dawn/WebGPU et les versions RN/Reanimated/Worklets compatibles, relire les imports/sorties de buffers, les soumissions vérifiées, la fermeture canvas/snapshot et les budgets/caches Graphite, revoir les empreintes, compiler les deux plateformes, exécuter les tests de pixels/timestamps puis les **65 workloads du catalogue `2026-10-07.1`** (59 historiques, trois lectures continues `copy` et leurs trois équivalents `direct`) et les sessions longues. La configuration iPhone déjà compilée pour la référence 3.0.3 utilise RN 0.86.2, Reanimated 4.5.3 et Worklets 0.11.3 ; ces versions sont conservées pour la migration 3.0.6. Ne pas laisser une plage ouverte sélectionner une autre version sans refaire l'installation native. Documenter la version et le transport effectif dans les résultats. La présence d'un cas dans le catalogue ne signifie pas qu'il a été exécuté sur toutes les cibles. Une correction amont ou des tests de l'hôte verts seuls ne justifient pas de supprimer un garde-fou mémoire.
230
+ Pour chaque nouvelle version Skia : relever le couple Dawn/WebGPU et les versions RN/Reanimated/Worklets compatibles, relire les imports/sorties de buffers, les soumissions vérifiées, la fermeture canvas/snapshot et les budgets/caches Graphite, revoir les empreintes, compiler les deux plateformes, exécuter les tests de pixels/timestamps puis les **67 workloads du catalogue `2026-10-07.1`** (59 historiques, trois lectures continues `copy` et leurs trois équivalents `direct`, plus les deux exports 4K → 4K ajoutés le 24 octobre 2026 sans changer les autres) et les sessions longues. La configuration iPhone déjà compilée pour la référence 3.0.3 utilise RN 0.86.2, Reanimated 4.5.3 et Worklets 0.11.3 ; ces versions sont conservées pour la migration 3.0.6. Ne pas laisser une plage ouverte sélectionner une autre version sans refaire l'installation native. Documenter la version et le transport effectif dans les résultats. La présence d'un cas dans le catalogue ne signifie pas qu'il a été exécuté sur toutes les cibles. Une correction amont ou des tests de l'hôte verts seuls ne justifient pas de supprimer un garde-fou mémoire.
@@ -32,7 +32,9 @@ static inline NSDictionary* SDRColorProperties() {
32
32
  /**
33
33
  * Whether a track needs AVFoundation's conversion to Rec.709 even when its
34
34
  * frames are decoded to NV12: an HDR transfer function (HLG, PQ) or BT.2020
35
- * primaries, which only a tone mapping brings to SDR.
35
+ * primaries, which only a tone mapping brings to SDR, and the Display P3 or
36
+ * DCI-P3 primaries or sRGB transfer function of a file recorded or exported
37
+ * for a wide-gamut screen, which BGRA output converts too.
36
38
  *
37
39
  * An SDR track decoded to NV12 is left as it is: its buffers carry their own
38
40
  * YCbCr matrix, which the GPU applies when it converts them. Asked for Rec.709
@@ -52,9 +54,12 @@ static inline bool TrackNeedsSDRConversion(AVAssetTrack* track) {
52
54
  CFTypeRef primaries = CMFormatDescriptionGetExtension(
53
55
  format, kCMFormatDescriptionExtension_ColorPrimaries);
54
56
  if (transfer && (CFEqual(transfer, kCVImageBufferTransferFunction_ITU_R_2100_HLG) ||
55
- CFEqual(transfer, kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ)))
57
+ CFEqual(transfer, kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ) ||
58
+ CFEqual(transfer, kCVImageBufferTransferFunction_sRGB)))
56
59
  return true;
57
- if (primaries && CFEqual(primaries, kCVImageBufferColorPrimaries_ITU_R_2020))
60
+ if (primaries && (CFEqual(primaries, kCVImageBufferColorPrimaries_ITU_R_2020) ||
61
+ CFEqual(primaries, kCVImageBufferColorPrimaries_P3_D65) ||
62
+ CFEqual(primaries, kCVImageBufferColorPrimaries_DCI_P3)))
58
63
  return true;
59
64
  }
60
65
  return false;
@@ -9,10 +9,8 @@ export const getVideoCanvas = surface => {
9
9
  throw new Error("Skia checked submission patch is missing from the native binary. Apply the patch and rebuild the native app.");
10
10
  }
11
11
  checked.enableCheckedSubmissions();
12
- const canvas = surface.getCanvas();
13
- if (typeof canvas.dispose !== "function") {
14
- throw new Error("Skia canvas lifecycle patch is missing from the native binary. Apply the patch and rebuild the native app.");
15
- }
16
- return canvas;
12
+ // Owned by the surface: its dispose() detaches the canvas, and drawing on
13
+ // it throws from then on.
14
+ return surface.getCanvas();
17
15
  };
18
16
  //# sourceMappingURL=canvas.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getVideoCanvas","surface","checked","enableCheckedSubmissions","Error","canvas","getCanvas","dispose"],"sourceRoot":"../../src","sources":["canvas.ts"],"mappings":";;AAEA;AACA,OAAO,MAAMA,cAAc,GAAIC,OAAkB,IAAe;EAC9D,SAAS;;EACT,MAAMC,OAAO,GAAGD,OAEf;EACD,IAAI,OAAOC,OAAO,CAACC,wBAAwB,KAAK,UAAU,EAAE;IAC1D,MAAM,IAAIC,KAAK,CACb,8GACF,CAAC;EACH;EACAF,OAAO,CAACC,wBAAwB,CAAC,CAAC;EAClC,MAAME,MAAM,GAAGJ,OAAO,CAACK,SAAS,CAAC,CAAC;EAClC,IAAI,OAAOD,MAAM,CAACE,OAAO,KAAK,UAAU,EAAE;IACxC,MAAM,IAAIH,KAAK,CACb,4GACF,CAAC;EACH;EACA,OAAOC,MAAM;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getVideoCanvas","surface","checked","enableCheckedSubmissions","Error","getCanvas"],"sourceRoot":"../../src","sources":["canvas.ts"],"mappings":";;AAEA;AACA,OAAO,MAAMA,cAAc,GAAIC,OAAkB,IAAe;EAC9D,SAAS;;EACT,MAAMC,OAAO,GAAGD,OAEf;EACD,IAAI,OAAOC,OAAO,CAACC,wBAAwB,KAAK,UAAU,EAAE;IAC1D,MAAM,IAAIC,KAAK,CACb,8GACF,CAAC;EACH;EACAF,OAAO,CAACC,wBAAwB,CAAC,CAAC;EAClC;EACA;EACA,OAAOF,OAAO,CAACI,SAAS,CAAC,CAAC;AAC5B,CAAC","ignoreList":[]}
@@ -5,7 +5,7 @@ import { Platform } from "react-native";
5
5
  import { BlendMode, Skia } from "react-native-skia";
6
6
  import { createNativeVideoGpuFrame, getVideoGpuDevice, nativeVideoTextureUsage } from "./gpuDevice.js";
7
7
  import { frameByteSize, releaseVideoMemory, reserveVideoMemory } from "./memory.js";
8
- import { blitNv12Frame, blitYuvFrame, releaseYuvImports, yuvFrameOrigin } from "./yuvBlit.js";
8
+ import { blitNv12Frame, blitYuvFrame, releaseYuvImports, yuvFrameRegion } from "./yuvBlit.js";
9
9
 
10
10
  /** A decoded frame sampled in place, without an owned snapshot: a BGRA
11
11
  * frame's IOSurface on iOS, or for a YUV frame (Android, iOS NV12) its
@@ -106,10 +106,7 @@ const importYuvExportFrame = (imports, frame) => {
106
106
  // iOS NV12: the whole buffer, in decoded orientation.
107
107
  const nv12 = source.format === "nv12";
108
108
  if (nv12 && (entry.nativeFrame.width !== frame.width || entry.nativeFrame.height !== frame.height)) throw new Error("Native video buffer dimensions mismatch");
109
- const origin = nv12 ? {
110
- x: 0,
111
- y: 0
112
- } : yuvFrameOrigin(source.region, rotation, entry.nativeFrame, frame);
109
+ const region = nv12 ? null : yuvFrameRegion(source.region, rotation, entry.nativeFrame);
113
110
  const device = getVideoGpuDevice();
114
111
  target = imports.textures.get(producer);
115
112
  if (target && (target.texture.width !== frame.width || target.texture.height !== frame.height)) {
@@ -141,8 +138,8 @@ const importYuvExportFrame = (imports, frame) => {
141
138
  }
142
139
  // Can throw after submitting: drain below before giving the lease back.
143
140
  submitted = true;
144
- if (nv12) blitNv12Frame(device, entry.nativeFrame, target.texture);else blitYuvFrame(device, imports.yuv, producer, entry.nativeFrame, rotation, origin, frame.width, frame.height, target.texture);
145
- entry.image = Skia.Image.MakeImageFromGPUTexture(target.texture);
141
+ if (nv12) blitNv12Frame(device, entry.nativeFrame, target.texture);else blitYuvFrame(device, imports.yuv, producer, entry.nativeFrame, rotation, region, target.texture);
142
+ entry.image = Skia.Image.MakeFromGPUTexture(target.texture);
146
143
  if (!entry.image) throw new Error("Cannot wrap the decoded frame");
147
144
  return entry;
148
145
  } catch (error) {
@@ -200,7 +197,7 @@ export const importExportFrame = (frame, imports) => {
200
197
  entry.texture = entry.memory.createTexture();
201
198
  entry.memory.beginAccess(entry.texture, true);
202
199
  entry.accessing = true;
203
- entry.image = Skia.Image.MakeImageFromGPUTexture(entry.texture);
200
+ entry.image = Skia.Image.MakeFromGPUTexture(entry.texture);
204
201
  if (!entry.image) throw new Error("Cannot wrap the decoded frame");
205
202
  return entry;
206
203
  } catch (error) {
@@ -237,8 +234,9 @@ export const releaseExportFrames = imports => {
237
234
 
238
235
  /** The export counterpart of ownVideoFrames on iOS: decoded frames are drawn
239
236
  * in place, and a producer's previous frame is released once its next one is
240
- * imported, since every exported frame ends with a checked GPU wait. Other
241
- * frames, or every frame after a first failed import, use `fallback`. */
237
+ * imported, since the export waits for the GPU to complete a frame before it
238
+ * imports the next one. Other frames, or every frame after a first failed
239
+ * import, use `fallback`. */
242
240
  export const ownExportFrames = (imports, decoded, fallback) => {
243
241
  "worklet";
244
242
 
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","BlendMode","Skia","createNativeVideoGpuFrame","getVideoGpuDevice","nativeVideoTextureUsage","frameByteSize","releaseVideoMemory","reserveVideoMemory","blitNv12Frame","blitYuvFrame","releaseYuvImports","yuvFrameOrigin","convertsYuv","OS","createExportFrameImports","entries","Map","producers","Set","enabled","imported","textures","yuv","canImportInPlace","frame","texture","kind","id","undefined","region","releaseExportFrame","entry","image","dispose","accessing","memory","ended","endAccess","state","fences","fence","destroy","nativeFrame","release","releaseProducerTexture","imports","producer","target","get","reservation","delete","importYuvExportFrame","producerId","source","submitted","nativeBuffer","rotation","nv12","format","width","height","Error","origin","x","y","device","createTexture","size","usage","label","error","set","Image","MakeImageFromGPUTexture","drain","Surface","MakeFromGPUTexture","getCanvas","drawColor","Color","Clear","flush","importExportFrame","pixelFormat","importSharedTextureMemory","handle","beginAccess","releaseExportFrames","keys","ownExportFrames","decoded","fallback","owned","held","current","key","Object","seen","next","console","warn","String","add","aliases","WeakSet","has","crop","values","rest","copying"],"sourceRoot":"../../src","sources":["exportFrames.ts"],"mappings":";;AAAA;AACA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,SAAS,EAAEC,IAAI,QAAQ,mBAAmB;AAOnD,SACEC,yBAAyB,EACzBC,iBAAiB,EACjBC,uBAAuB,QA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AAI,CAACY,GAAG,CAACjF,KAAK,CAAC,EAAE;MACrB,MAAMsB,QAAQ,GAAGtB,KAAK,CAAC4B,UAAU,IAAI5B,KAAK,CAACG,EAAE;MAC7C,MAAMI,KAAK,GACTe,QAAQ,KAAKlB,SAAS,GAAGA,SAAS,GAAGiB,OAAO,CAAC9B,OAAO,CAACiC,GAAG,CAACF,QAAQ,CAAC;MACpE,IAAIf,KAAK,IAAIA,KAAK,CAACJ,EAAE,KAAKH,KAAK,CAACG,EAAE,EAAE;MACpC,IAAI;QACFH,KAAK,CAACS,OAAO,GAAG,CAAC;MACnB,CAAC,CAAC,MAAM;QACN;MAAA;IAEJ;IACA,MAAMqC,KAAK;EACb;EACA;EACA,MAAMsC,IAAgC,GAAG,CAAC,CAAC;EAC3C,IAAIC,OAAO,GAAG,KAAK;EACnB,KAAK,MAAM,CAACd,GAAG,EAAEvE,KAAK,CAAC,IAAIwE,MAAM,CAACjF,OAAO,CAAC2E,OAAO,CAAC,EAAE;IAClD,IAAIG,IAAI,CAACY,GAAG,CAACjF,KAAK,CAAC,EAAE;IACrBoF,IAAI,CAACb,GAAG,CAAC,GAAGvE,KAAK;IACjBqF,OAAO,GAAG,IAAI;EAChB;EACA,OAAOA,OAAO,GAAG;IAAE,GAAGjB,KAAK;IAAE,GAAGD,QAAQ,CAACiB,IAAI;EAAE,CAAC,GAAGhB,KAAK;AAC1D,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Platform","BlendMode","Skia","createNativeVideoGpuFrame","getVideoGpuDevice","nativeVideoTextureUsage","frameByteSize","releaseVideoMemory","reserveVideoMemory","blitNv12Frame","blitYuvFrame","releaseYuvImports","yuvFrameRegion","convertsYuv","OS","createExportFrameImports","entries","Map","producers","Set","enabled","imported","textures","yuv","canImportInPlace","frame","texture","kind","id","undefined","region","releaseExportFrame","entry","image","dispose","accessing","memory","ended","endAccess","state","fences","fence","destroy","nativeFrame","release","releaseProducerTexture","imports","producer","target","get","reservation","delete","importYuvExportFrame","producerId","source","submitted","nativeBuffer","rotation","nv12","format","width","height","Error","device","createTexture","size","usage","label","error","set","Image","MakeFromGPUTexture","drain","Surface","getCanvas","drawColor","Color","Clear","flush","importExportFrame","pixelFormat","importSharedTextureMemory","handle","beginAccess","releaseExportFrames","keys","ownExportFrames","decoded","fallback","owned","held","current","key","Object","seen","next","console","warn","String","add","aliases","WeakSet","has","crop","values","rest","copying"],"sourceRoot":"../../src","sources":["exportFrames.ts"],"mappings":";;AAAA;AACA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,SAAS,EAAEC,IAAI,QAAQ,mBAAmB;AAOnD,SACEC,yBAAyB,EACzBC,iBAAiB,EACjBC,uBAAuB,QAClB,gBAAa;AACpB,SACEC,aAAa,EACbC,kBAAkB,EAClBC,kBAAkB,QACb,aAAU;AAEjB,SACEC,aAAa,EACbC,YAAY,EACZC,iBAAiB,EACjBC,cAAc,QACT,cAAW;;AAGlB;AACA;AACA;AACA;;AAaA;;AAGA;AACA;;AA4BA;AACA;AACA,MAAMC,WAAW,GAAGb,QAAQ,CAACc,EAAE,KAAK,SAAS;AAE7C,OAAO,MAAMC,wBAAwB,GAAGA,CAAA,KAA0B;EAChE,SAAS;;EACT,OAAO;IACLC,OAAO,EAAE,IAAIC,GAAG,CAAC,CAAC;IAClBC,SAAS,EAAE,IAAIC,GAAG,CAAC,CAAC;IACpBC,OAAO,EAAE,IAAI;IACbC,QAAQ,EAAE,KAAK;IACfC,QAAQ,EAAE,IAAIL,GAAG,CAAC,CAAC;IACnBM,GAAG,EAAE,IAAIN,GAAG,CAAC;EACf,CAAC;AACH,CAAC;;AAED;AACA,OAAO,MAAMO,gBAAgB,GAAIC,KAAiB,IAAc;EAC9D,SAAS;;EACT,MAAMC,OAAO,GAAGD,KAAK,CAACC,OAAiD;EACvE,OACEA,OAAO,EAAEC,IAAI,KAAK,eAAe,IACjCF,KAAK,CAACG,EAAE,KAAKC,SAAS,KACrB,CAAChB,WAAW,IAAIa,OAAO,CAACI,MAA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