Skip to content

fix(📹): preserve Android video frames before disposal - #4019

Open
ngocdevv wants to merge 4 commits into
Shopify:mainfrom
ngocdevv:fix-android-video-frame-lifetime
Open

fix(📹): preserve Android video frames before disposal#4019
ngocdevv wants to merge 4 commits into
Shopify:mainfrom
ngocdevv:fix-android-video-frame-lifetime

Conversation

@ngocdevv

Copy link
Copy Markdown

Summary

  • copy each Android video texture to a non-texture image before disposing the decoder-backed texture
  • dispose the previously displayed frame when the video advances
  • add coverage for Android copy/disposal lifetime and unchanged iOS behavior

Context

copyFrameOnAndroid currently assigns tex back to currentFrame and immediately calls tex.dispose(), so the renderer receives a disposed texture. Restoring makeNonTextureImage() fixes the black or frozen canvas reported in #4000.

The Graphite implementation now supports this conversion through the raster readback path added in #3893, after the original call was disabled in #3686.

Test plan

  • yarn workspace @shopify/react-native-skia tsc
  • yarn workspace @shopify/react-native-skia eslint src/external/reanimated/useVideo.ts src/external/reanimated/__tests__/useVideo.spec.ts --max-warnings 0
  • yarn workspace @shopify/react-native-skia test --runInBand — 88 suites passed, 8 skipped; 754 tests passed
  • Physical Android validation was not available in this environment; the issue report validates the restored copy path on a Pixel 9 and Galaxy S23

Fixes #4000

@ngocdevv

Copy link
Copy Markdown
Author

I have signed the CLA!

@ngocdevv

Copy link
Copy Markdown
Author

Hi @wcandillon, when you have a chance, could you please take a look at this PR? It restores makeNonTextureImage() for Android video frames after the Graphite raster readback support added in #3893, fixes #4000, and includes lifecycle tests. The CI workflows are also awaiting maintainer approval. Could you please confirm whether this is the intended lifetime strategy and approve the workflows if appropriate?
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android useVideo renders a black/frozen canvas: copyFrameOnAndroid never copies the frame, then disposes it

2 participants