Skip to content

monitor-utils: Rework camera deduplication code

Robert Mader requested to merge rmader/wireplumber:issue708-2 into master

The previous code made some invalid assumptions and was rather complicated. Rework and simplify it.

The approach work as follows:

  1. Once a new device gets registred, store its data in a list of pending devices.
  2. Start a timer. On timeout, we check all pending devices and depulicate according to our heuristic. The timer gets reset whenever a device is added in order to avoid race conditions.
  3. In the creation funcion, add the pending devices to categories, currently: multi-device, UVC and other.
  4. When then process the different categories in order of preference and store the V4L2 devices they use in a list.
  5. All cameras of the multi-device category get created uncoditionally.
  6. UVC cameras only if they don't use a V4L2 that's already used by a multi-device camera.
  7. Finally we create cameras that don't use V4L2 cameras of either of the previous categories.

While on it, drop support for Pipewire versions that don't report V4L2 device IDs at all.

Closes #689 Closes #708


Previous attempt: !670 (closed)

Merge request reports