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

When mediaServicesWereReset occurs, a crash happens with AVCaptureSession during startRunning. #1522

Closed
levs42 opened this issue Jul 26, 2024 · 3 comments
Milestone

Comments

@levs42
Copy link
Contributor

levs42 commented Jul 26, 2024

Describe the bug

We have a popular crash that looks like this:

*** -[AVCaptureSession startRunning] startRunning may not be called between calls to beginConfiguration and commitConfiguration

Stack trace:

HaishinKit IOCaptureSession.startRunningIfNeeded (IOCaptureSession.swift:182)
HaishinKit IOCaptureSession.sessionRuntimeError (IOCaptureSession.swift:243)
...
App main (AppDelegate.swift:9)

From my understanding this happens because there is a race condition between startRunningIfNeeded and configuration or sessionPreset in IOCaptureSession. There was a fix #1239 for the similar issue before. Maybe wrapping beginConfiguration into a serial queue would solve the problem entirely?

To Reproduce

.mediaServicesWereReset notification is very rare so I don't have exact steps to reproduce it. I saw some people suggest:

Now I'm finally able to reproduce the problem by simply repeating the normal operations of the app thousands of times in an automatic test

Expected behavior

No crash

Version

1.8.1

Smartphone info.

No response

Additional context

No response

Screenshots

No response

Relevant log output

No response

@shogo4405
Copy link
Owner

Is the focus of this issue on the rare case when the event mediaServicesWereReset occurs?

@levs42
Copy link
Contributor Author

levs42 commented Jul 29, 2024

Yes, that's the case

@shogo4405 shogo4405 changed the title AVCaptureSession startRunning crash When mediaServicesWereReset occurs, a crash happens with AVCaptureSession during startRunning. Jul 29, 2024
@shogo4405
Copy link
Owner

Close as fixed #1526

@shogo4405 shogo4405 added this to the 1.9.3 milestone Aug 8, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants