monitors/libcamera: load node locally

At the moment the libcamera monitor and "Device" objects are loaded in the
wireplumber process, but the "Node" objects are loaded in the pipewire daemon.
Due to that, both processes have their own separate `libcamera::CameraManager`
objects. These operate independently.

As a consequence of the above, there is an inherent race condition: when a
new camera appears and the wireplumber process detects it and instructs the
pipewire process to create a "Node" for it, at that point, the camera might
not exist in the `CameraManager` of the "pipewire" process.

This can happen during the initial enumeration as well as hotplug. So load
the nodes locally in the wireplumber process so that all libcamera objects
use the same `CameraManager`, thus eliminating the race condition.
This commit is contained in:
Barnabás Pőcze 2026-01-29 10:08:05 +01:00
parent cbbd035131
commit 9dd004347c
2 changed files with 4 additions and 1 deletions

View file

@ -470,6 +470,9 @@ wireplumber.components = [
{
name = monitors/libcamera/create-node.lua, type = script/lua
provides = hooks.monitor.libcamera-create-node
requires = [ support.export-core,
pw.client-node,
pw.node-factory.spa ]
}
{
name = monitors/libcamera/enumerate-device.lua, type = script/lua

View file

@ -34,7 +34,7 @@ SimpleEventHook {
return
end
-- create the node
local node = Node ("spa-node-factory", properties)
local node = LocalNode ("spa-node-factory", properties)
node:activate (Feature.Proxy.BOUND)
parent:store_managed_object (id, node)
end