Skip to content

iOS NativeCamera session start/stop synchronization #1137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Alex-MSFT
Copy link
Contributor

@Alex-MSFT Alex-MSFT commented Sep 19, 2022

Description

This PR fixes a few issues around NativeCamera start/stop synchronization.

  • The primary change is switching from using dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) to using an arcana background scheduler for starting/stopping the AR camera session. This is necessary as calls to avCaptureSession stopRunning and avCaptureSession startRunning must be serialized or it will result in a crash at runtime.
  • The second major change is changing CameraImpl to not be disposed on reset, but to instead handle managing its resources, and re-use durable resources across sessions.
  • Removed unnecessary dispatch to the main thread in Open which could cause the camera to hang
  • Texture creation promise will not resolve until the native camera session is actually ready

I recommend viewing this PR with whitespace ignored, as the removal of the synchronization caused a lot of spacing changes.

Validation

Ran in the Babylon Native Playground, as well as in our test application that consumes this code through Babylon React Native and heavily exercises this code path.

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.

3 participants