wireplumber/0001-alsa.lua-remove-the-disabled-entities-from-the-names-table.patch

61 lines
2.0 KiB
Diff
Raw Normal View History

From e77ad8c0c024529deb4de5ebd69009a0cec11a78 Mon Sep 17 00:00:00 2001
From: Ashok Sidipotu <ashok.sidipotu@collabora.com>
Date: Tue, 8 Nov 2022 04:20:21 +0530
Subject: [PATCH] alsa.lua: remove the disabled entities from the names table
entities here are the device cards and the device nodes.
sometimes null device objects are reported by monitor, this results in lua
exceptions handle this use case.
Fixes #361
---
src/scripts/monitors/alsa.lua | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua
index 660c47c0..195c0916 100644
--- a/src/scripts/monitors/alsa.lua
+++ b/src/scripts/monitors/alsa.lua
@@ -175,6 +175,7 @@ function createNode(parent, id, obj_type, factory, properties)
-- apply properties from config.rules
rulesApplyProperties(properties)
if properties["node.disabled"] then
+ node_names_table [properties ["node.name"]] = nil
return
end
@@ -190,6 +191,10 @@ function createDevice(parent, id, factory, properties)
device:connect("create-object", createNode)
device:connect("object-removed", function (parent, id)
local node = parent:get_managed_object(id)
+ if not node then
+ return
+ end
+
node_names_table[node.properties["node.name"]] = nil
end)
device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND)
@@ -269,6 +274,7 @@ function prepareDevice(parent, id, obj_type, factory, properties)
-- apply properties from config.rules
rulesApplyProperties(properties)
if properties["device.disabled"] then
+ device_names_table [properties ["device.name"]] = nil
return
end
@@ -346,6 +352,10 @@ function createMonitor ()
-- handle object-removed to destroy device reservations and recycle device name
m:connect("object-removed", function (parent, id)
local device = parent:get_managed_object(id)
+ if not device then
+ return
+ end
+
if rd_plugin then
local rd_name = device.properties["api.dbus.ReserveDevice1"]
if rd_name then
--
GitLab