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

Make AVCaptureSession calls thread safe #1526

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

levs42
Copy link
Contributor

@levs42 levs42 commented Jul 31, 2024

Description & motivation

This PR is a fix for #1522 to make AVCaptureSession startRunning and beginConfiguration calls thread safe.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Copy link
Owner

@shogo4405 shogo4405 left a comment

Choose a reason for hiding this comment

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

In the design of HK, the role of lockQueue is assigned to IOStream.lockQueue.
In the PR, both IOStream.lockQueue and IOCaptureSession have lockQueue, causing a redundancy in roles, which is unacceptable.
If you stop placing lockQueue in IOCaptureSession and instead use IOStream's lockQueue, it will be acceptable.

@levs42 levs42 force-pushed the bugfix/media-services-reset branch from 7c20bf9 to cfa815a Compare August 6, 2024 18:52
@levs42 levs42 force-pushed the bugfix/media-services-reset branch from cfa815a to fa3259a Compare August 6, 2024 18:59
@levs42
Copy link
Contributor Author

levs42 commented Aug 6, 2024

Updated, please take a look

@shogo4405
Copy link
Owner

Test

Case 1

  1. Launch Example app.
  2. Launch Settings.app
    1. [Develop] -> [Reset MediaService]
  3. Return Example app.

It works a camera and a microphone.

Case 2
https://github.com/search?q=repo%3Ashogo4405%2FHaishinKit.swift+Camera.app&type=issues
Case 1 and Case 2. It seems ok. I accepted.

Copy link
Owner

@shogo4405 shogo4405 left a comment

Choose a reason for hiding this comment

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

👍

@shogo4405 shogo4405 merged commit b89d1f7 into shogo4405:main Aug 8, 2024
1 check failed
@levs42
Copy link
Contributor Author

levs42 commented Aug 8, 2024

Awesome, thank you for sharing.

@levs42 levs42 deleted the bugfix/media-services-reset branch August 9, 2024 16:56
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