avfvideosrc device-index property is not stable on modern macOS systems
Problem
If a user wants to launch a specific camera on macOS, the following launch line is typcially used: avfvideosrc device-index=42
. Device index refers to a specific position within the list returned by the (deprecated) [AVCaptureDevice devicesWithMediaType:mediaType]
. However, on modern macOS, the order of this list is not stable and thus essentially a random camera is selected on every start.
Expected Behavior
If a specific device is selected, it should actually use that camera.
Observed Behavior
A random camera is used.
Setup
- macOS Ventura 13.1 (22C65)
- Device: Computer
- GStreamer Version: 1.21.90, built from source
How reproducible is the bug?
Always.
Additional Info
The correct solution is to use the [AVCaptureDevice uniqueId]
property when selecting a camera.
I already have a fix, and will provide a Merge Request soon.