Skip to content

Conversation

@jazzychad
Copy link
Contributor

Fix issue where AVCaptureDevice.usbDevice() would return a USBDevice
pointing to the wrong camera if multiple cameras with the same product
id and vendor id are attached to the computer.

The new approach is to use an iterator to lookup the cameras with the
given vendor and product ids, and then loop through the results and
match against their property dictionaries against the
avDevice.localizedName since that seems to be the only reliable way to
disambiguate between different cameras with otherwise similar
properties.

Fix issue where `AVCaptureDevice.usbDevice()` would return a USBDevice
pointing to the wrong camera if multiple cameras with the same product
id and vendor id are attached to the computer.

The new approach is to use an iterator to lookup the cameras with the
given vendor and product ids, and then loop through the results and
match against their property dictionaries against the
avDevice.localizedName since that seems to be the only reliable way to
disambiguate between different cameras with otherwise similar
properties.
@jazzychad
Copy link
Contributor Author

There may be a better approach to solve this issue, but this is one that I came up with that works in my situation.

I am happy to hear other ideas about how to solve this.

@itaybre
Copy link
Owner

itaybre commented May 4, 2022

I was going to tell you about using a function, but seems like you already did that :)

Looks good, I am not on my machine, but I try it once I get it

@itaybre
Copy link
Owner

itaybre commented May 5, 2022

Seems to be working fine, merging

@itaybre itaybre merged commit 73d2c1c into itaybre:master May 5, 2022
@itaybre itaybre modified the milestones: 1.3, 1.4.0 May 5, 2022
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