wireplumber/0008-scripts-monitors-log-warning-if-spa-devices-were-not.patch
Antonio Larrosa 23c5d9eadf Accepting request 948445 from home:alarrosa:branches:multimedia:libs
- Back to version 0.4.6, and add patches incrementally
  to bisect it and find the issue
  * 0001-policy-node-fix-typo-when-finding-best-target.patch
  * 0002-policy-node-schedule-a-rescan-without-timeout-if-def.patch
  * 0003-policy-node-find-best-linkable-if-default-one-cannot.patch
  * 0004-spa-pod-fix-different-architecture-errors-for-boolea.patch
  * 0005-config-update-the-endpoints-config.patch
  * 0006-policy-endpoint-client.lua-fix-record-with-endpoints.patch
  * 0007-default-nodes-check-if-the-ports-exist-in-rescan_om.patch
  * 0008-scripts-monitors-log-warning-if-spa-devices-were-not.patch
- Remove revert from previous change:
  * 0001-reversed-default-nodes-check-if-default-node-has-available-ro.patch

OBS-URL: https://build.opensuse.org/request/show/948445
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=24
2022-01-24 16:17:22 +00:00

101 lines
3.7 KiB
Diff

From 40b16974cf800ce728c7f084fbdd8b30b7a9f03c Mon Sep 17 00:00:00 2001
From: Julian Bouzas <julian.bouzas@collabora.com>
Date: Tue, 11 Jan 2022 11:27:33 -0500
Subject: [PATCH 08/14] scripts: monitors: log warning if spa devices were not
created successfully
Can happen if the user does not have the specific spa pluging installed.
---
src/scripts/monitors/alsa.lua | 10 +++++++---
src/scripts/monitors/bluez.lua | 9 +++++++--
src/scripts/monitors/libcamera.lua | 10 +++++++---
src/scripts/monitors/v4l2.lua | 10 +++++++---
4 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua
index be4648e..8d297c1 100644
--- a/src/scripts/monitors/alsa.lua
+++ b/src/scripts/monitors/alsa.lua
@@ -177,9 +177,13 @@ end
function createDevice(parent, id, factory, properties)
local device = SpaDevice(factory, properties)
- device:connect("create-object", createNode)
- device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND)
- parent:store_managed_object(id, device)
+ if device then
+ device:connect("create-object", createNode)
+ device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND)
+ parent:store_managed_object(id, device)
+ else
+ Log.warning ("Failed to create '" .. factory .. "' device")
+ end
end
function prepareDevice(parent, id, type, factory, properties)
diff --git a/src/scripts/monitors/bluez.lua b/src/scripts/monitors/bluez.lua
index 172e013..4a54a7b 100644
--- a/src/scripts/monitors/bluez.lua
+++ b/src/scripts/monitors/bluez.lua
@@ -109,8 +109,13 @@ function createDevice(parent, id, type, factory, properties)
-- create the device
device = SpaDevice(factory, properties)
- device:connect("create-object", createNode)
- parent:store_managed_object(id, device)
+ if device then
+ device:connect("create-object", createNode)
+ parent:store_managed_object(id, device)
+ else
+ Log.warning ("Failed to create '" .. factory .. "' device")
+ return
+ end
end
Log.info(parent, string.format("%d, %s (%s): %s",
diff --git a/src/scripts/monitors/libcamera.lua b/src/scripts/monitors/libcamera.lua
index e6e3ed9..27c7459 100644
--- a/src/scripts/monitors/libcamera.lua
+++ b/src/scripts/monitors/libcamera.lua
@@ -125,9 +125,13 @@ function createDevice(parent, id, type, factory, properties)
-- create the device
local device = SpaDevice(factory, properties)
- device:connect("create-object", createNode)
- device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND)
- parent:store_managed_object(id, device)
+ if device then
+ device:connect("create-object", createNode)
+ device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND)
+ parent:store_managed_object(id, device)
+ else
+ Log.warning ("Failed to create '" .. factory .. "' device")
+ end
end
monitor = SpaDevice("api.libcamera.enum.manager", config.properties or {})
diff --git a/src/scripts/monitors/v4l2.lua b/src/scripts/monitors/v4l2.lua
index fd9a20d..102eb81 100644
--- a/src/scripts/monitors/v4l2.lua
+++ b/src/scripts/monitors/v4l2.lua
@@ -125,9 +125,13 @@ function createDevice(parent, id, type, factory, properties)
-- create the device
local device = SpaDevice(factory, properties)
- device:connect("create-object", createNode)
- device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND)
- parent:store_managed_object(id, device)
+ if device then
+ device:connect("create-object", createNode)
+ device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND)
+ parent:store_managed_object(id, device)
+ else
+ Log.warning ("Failed to create '" .. factory .. "' device")
+ end
end
monitor = SpaDevice("api.v4l2.enum.udev", config.properties or {})
--
2.34.1