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 registered, 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. On timeout, add the pending devices to categories. For now: UVC cameras from the V4L2 plugin, libcamera cameras and other cameras from the V4L2 plugin.
  4. Then process the different categories in order of preference and store their V4L2 device IDs in a list for each plugin.
  5. Before creating a camera, check that the V4L2 device(s) it uses are not yet used by a already existing camera from the other plugin.

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

Closes #689 (closed) Closes #708 (closed)


Previous attempt: !670 (closed)

Edited by Robert Mader

Merge request reports

Loading