Skip to content
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

fix: DispatchQueue for synchronizing the session configuration and start operations #214

Open
wants to merge 8 commits into
base: next
Choose a base branch
from

Conversation

jimcase
Copy link

@jimcase jimcase commented Dec 13, 2024

This PR addresses synchronization issues reported on an Apple Developer Forum thread, where users encountered NSGenericException due to premature execution of AVCaptureSession.startRunning(). The problem arises from startRunning() being called before the completion of commitConfiguration(), especially noted in iOS 17 and some iOS 16 devices.

To resolve this, we introduce a serial DispatchQueue for managing AVCaptureSession operations in a FIFO (First In, First Out) sequence. Configuration tasks are encapsulated within a synchronous block to ensure complete setup before proceeding. Following this, startRunning() is scheduled asynchronously, guaranteeing it executes only after the configuration is fully committed. This approach not only prevents the NSGenericException by ensuring proper sequence of operations but also maintains high performance and responsiveness of the application.## Pull request checklist

Related PR fix(barcode-scanning): add delay before starting camera session #188

Please check if your PR fulfills the following requirements:

  • The changes have been tested successfully.
  • A changeset has been created (npm run changeset).
  • I have read and followed the pull request guidelines.

Copy link
Member

@robingenz robingenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create your PR against next and not against main.

.changeset/forty-avocados-allow.md Outdated Show resolved Hide resolved
@robingenz
Copy link
Member

@jimcase Is this PR ready for review?

@jimcase
Copy link
Author

jimcase commented Jan 8, 2025

@robingenz Yes, its ready

@robingenz
Copy link
Member

@jimcase Please create your PR against thenext branch and not against the main branch. Please also solve all possible merge conflicts.

@jimcase jimcase changed the base branch from main to next January 8, 2025 11:25
@jimcase jimcase requested a review from robingenz January 13, 2025 12:29
@robingenz
Copy link
Member

@jimcase Please merge the latest origin/next changes.

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.

2 participants