From 9dd004347c126ec01ac5cf6b034e772e75f2c3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 29 Jan 2026 10:08:05 +0100 Subject: [PATCH] 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. --- src/config/wireplumber.conf | 3 +++ src/scripts/monitors/libcamera/create-node.lua | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/config/wireplumber.conf b/src/config/wireplumber.conf index ee1aa1d6..b94c06b6 100644 --- a/src/config/wireplumber.conf +++ b/src/config/wireplumber.conf @@ -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 diff --git a/src/scripts/monitors/libcamera/create-node.lua b/src/scripts/monitors/libcamera/create-node.lua index 706cb8df..4a73a7ec 100644 --- a/src/scripts/monitors/libcamera/create-node.lua +++ b/src/scripts/monitors/libcamera/create-node.lua @@ -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