fix: wait for Android exposure capture readiness#3992
Draft
mrousavy wants to merge 6 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
|
i think this is BS, CameraX should allow us operating with the Camera after |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This keeps Android
CameraSession.start()scoped to CameraX camera-state readiness, and moves capture-result readiness to the controller operation that actually needs it: supported, in-range, state-changingsetExposureBias(...)calls.It also keeps the Device Farm/Harness CI hardening from earlier commits:
Why
The Harness diagnostic run for
visioncamera.controller.harness.tsshowed the Android bridge timeout happened while the controller test was running:CameraX exposure compensation futures complete from capture results. Waiting only for
CameraState.OPENis not always strong enough: the camera can be open while the capture-result pipeline has not yet produced the metadata CameraX uses to completesetExposureCompensationIndex(...).A previous attempt waited for the first capture result in every
CameraSession.start(). That made the controller suite pass once, but it was too broad: valid multi-output starts can have no consumer attached yet and should not fail just because no capture result is produced at start. This revision removes that global start wait and only fences the exposure-bias path that the logs identified.If the camera is open but no capture result arrives before applying exposure bias, the controller now fails after 5s with a specific native error instead of letting the Harness file-level RPC timeout burn roughly 120s. Invalid or no-op exposure-bias calls skip the readiness wait and still go through CameraX directly.
Verification
bun run lint-kotlin -- packages/react-native-vision-camera/android/src/main/java/com/margelo/nitro/camera/hybrids/HybridCameraController.kt packages/react-native-vision-camera/android/src/main/java/com/margelo/nitro/camera/hybrids/HybridCameraSession.ktcd apps/simple-camera/android && JAVA_HOME=/opt/homebrew/opt/openjdk@17 ./gradlew :react-native-vision-camera:compileDebugKotlin --no-daemon --console=plainDevice Farm is running again on
34b52f0cto verify that the Android controller suite still runs and the multi-output regression from the global start wait is gone.