pipewire/spa
Barnabás Pőcze 2c2808fab1 spa: libcamera: manager: fix id allocation
There is an issue in the id allocation mechanism which can result
in the different devices having the same id. Specifically, consider
the scenario where there are only two cameras, which have just been
added. In this case `impl::devices` looks like this:

   (0, camA) | (1, camB) | (?, nullptr) | ...

Now assume that `camA` is removed, after which the array appears
as follows:

  (1, camB) | (1, nullptr) | (?, nullptr) | ...

Then assume that a new camera appears. When `get_free_id()` runs,
when `i == 1`, it will observe that `devices[i].camera == nullptr`,
so it selects `1` as the id. Leading to the following:

  (1, camB) | (1, camC) | (?, nullptr) | ...

This is of course incorrect. The set of ids must be unique. When
wireplumber is faced with this situation it destroys the device
object for `camB` when `camC` is emitted.

Fix this by simply not moving elements in the `devices` array,
leaving everything where it is. In which case the array looks
like this:

  (nullptr) | (camB) | (nullptr) | ... // after `camA` removal
  (camC) | (camB) | (nullptr) | ... // after `camC` appearance

Note that `device::id` is removed, and the id is now derived from
the position in `impl::devices`.
2025-07-15 08:12:54 +00:00
..
examples Port videotestsrc to LoopUtils 2024-07-01 15:28:14 +00:00
include spa: debug: SPA_TYPE_Id is unsigned 2025-07-12 19:52:43 +00:00
include-private/spa-private spa: move dbus helpers out of bluez plugin 2024-02-05 13:03:20 +00:00
lib spa: add AC3, EAC3, TrueHD, DTS, MPEG-H formats 2025-05-29 21:41:51 +02:00
plugins spa: libcamera: manager: fix id allocation 2025-07-15 08:12:54 +00:00
tests Add GNU/Hurd support 2023-09-24 15:11:52 +00:00
tools spa-json-dump: fix compilation 2025-06-17 18:08:36 +02:00
meson.build bluez5: add PLC for MSBC using spandsp 2025-07-12 19:59:33 +00:00