Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/wireplumber/, media-video/wireplumber/files/
Date: Wed, 25 May 2022 22:59:13
Message-Id: 1653518819.e8f0e99a058f91e7d2209f5cd2282f908d1d449b.sam@gentoo
1 commit: e8f0e99a058f91e7d2209f5cd2282f908d1d449b
2 Author: Niklāvs Koļesņikovs <89q1r14hd <AT> relay <DOT> firefox <DOT> com>
3 AuthorDate: Fri May 20 13:58:29 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed May 25 22:46:59 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e8f0e99a
7
8 media-video/wireplumber: add 0.4.10-r2 and copy loong to 9999
9
10 This commit backports a fix for device reservation protocol where
11 multiple devices may get clashing name because they all get the same
12 name assigned to them while being reserved. It appears the fix may
13 need another commit to function, so adding the NULL fix pre-emptively.
14 And because that one introduced a new bug, adding a follow up fix
15 backport for that.
16
17 Unfortunately the current upstream fix for this breaks the fix for a
18 small audio glitch that may happen when changing the default device,
19 which as applied on Gentoo in the 0.4.10-r1 ebuild. This in effect
20 means no longer applying the corresponding patch. But the benefit
21 of not having potential device name clashes should outweigh that.
22
23 Finally 0.4.10-r1 was keyworded for ~loong but that's liable to getting
24 lost on version bumps, so copying it to the 9999 in an inactive state.
25
26 Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd <AT> relay.firefox.com>
27 Closes: https://github.com/gentoo/gentoo/pull/25574
28 Signed-off-by: Sam James <sam <AT> gentoo.org>
29
30 ...ix-device-name-deduplication-when-reserva.patch | 117 +++++++++++++++++++++
31 ...pting-allow-converting-GValue-holding-NUL.patch | 36 +++++++
32 ...10-m-lua-scripting-fix-object-refcounting.patch | 32 ++++++
33 ...er-9999.ebuild => wireplumber-0.4.10-r2.ebuild} | 8 +-
34 media-video/wireplumber/wireplumber-9999.ebuild | 2 +-
35 5 files changed, 193 insertions(+), 2 deletions(-)
36
37 diff --git a/media-video/wireplumber/files/wireplumber-0.4.10-alsa.lua-fix-device-name-deduplication-when-reserva.patch b/media-video/wireplumber/files/wireplumber-0.4.10-alsa.lua-fix-device-name-deduplication-when-reserva.patch
38 new file mode 100644
39 index 000000000000..610db0e11e89
40 --- /dev/null
41 +++ b/media-video/wireplumber/files/wireplumber-0.4.10-alsa.lua-fix-device-name-deduplication-when-reserva.patch
42 @@ -0,0 +1,117 @@
43 +https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/c00c5a6675b6640db13111c808eaa3251917c412
44 +
45 +From c00c5a6675b6640db13111c808eaa3251917c412 Mon Sep 17 00:00:00 2001
46 +From: Julian Bouzas <julian.bouzas@×××××××××.com>
47 +Date: Wed, 18 May 2022 10:51:41 -0400
48 +Subject: [PATCH] alsa.lua: fix device name deduplication when reservation is
49 + enabled
50 +
51 +Fixes #241
52 +---
53 + src/scripts/monitors/alsa.lua | 47 +++++++++++++++++++----------------
54 + 1 file changed, 25 insertions(+), 22 deletions(-)
55 +
56 +diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua
57 +index 01d241db..7beed3a8 100644
58 +--- a/src/scripts/monitors/alsa.lua
59 ++++ b/src/scripts/monitors/alsa.lua
60 +@@ -11,6 +11,10 @@ local config = ... or {}
61 + -- ensure config.properties is not nil
62 + config.properties = config.properties or {}
63 +
64 ++-- unique device/node name tables
65 ++device_names_table = nil
66 ++node_names_table = nil
67 ++
68 + -- preprocess rules and create Interest objects
69 + for _, r in ipairs(config.rules or {}) do
70 + r.interests = {}
71 +@@ -41,16 +45,6 @@ function rulesApplyProperties(properties)
72 + end
73 + end
74 +
75 +-function findDuplicate(parent, id, property, value)
76 +- for i = 0, id - 1, 1 do
77 +- local obj = parent:get_managed_object(i)
78 +- if obj and obj.properties[property] == value then
79 +- return true
80 +- end
81 +- end
82 +- return false
83 +-end
84 +-
85 + function nonempty(str)
86 + return str ~= "" and str or nil
87 + end
88 +@@ -125,11 +119,11 @@ function createNode(parent, id, type, factory, properties)
89 +
90 + -- deduplicate nodes with the same name
91 + for counter = 2, 99, 1 do
92 +- if findDuplicate(parent, id, "node.name", properties["node.name"]) then
93 +- properties["node.name"] = name .. "." .. counter
94 +- else
95 ++ if node_names_table[properties["node.name"]] ~= true then
96 ++ node_names_table[properties["node.name"]] = true
97 + break
98 + end
99 ++ properties["node.name"] = name .. "." .. counter
100 + end
101 + end
102 +
103 +@@ -186,6 +180,10 @@ function createDevice(parent, id, factory, properties)
104 + local device = SpaDevice(factory, properties)
105 + if device then
106 + device:connect("create-object", createNode)
107 ++ device:connect("object-removed", function (parent, id)
108 ++ local node = parent:get_managed_object(id)
109 ++ node_names_table[node.properties["node.name"]] = nil
110 ++ end)
111 + device:activate(Feature.SpaDevice.ENABLED | Feature.Proxy.BOUND)
112 + parent:store_managed_object(id, device)
113 + else
114 +@@ -205,11 +203,11 @@ function prepareDevice(parent, id, type, factory, properties)
115 +
116 + -- deduplicate devices with the same name
117 + for counter = 2, 99, 1 do
118 +- if findDuplicate(parent, id, "device.name", properties["device.name"]) then
119 +- properties["device.name"] = name .. "." .. counter
120 +- else
121 ++ if device_names_table[properties["device.name"]] ~= true then
122 ++ device_names_table[properties["device.name"]] = true
123 + break
124 + end
125 ++ properties["device.name"] = name .. "." .. counter
126 + end
127 +
128 + -- ensure the device has a description
129 +@@ -337,16 +335,21 @@ function createMonitor ()
130 + -- handle create-object to prepare device
131 + m:connect("create-object", prepareDevice)
132 +
133 +- -- if dbus reservation, handle object-removed to destroy device reservations
134 +- if rd_plugin then
135 +- m:connect("object-removed", function (parent, id)
136 +- local device = parent:get_managed_object(id)
137 ++ -- handle object-removed to destroy device reservations and recycle device name
138 ++ m:connect("object-removed", function (parent, id)
139 ++ local device = parent:get_managed_object(id)
140 ++ if rd_plugin then
141 + local rd_name = device.properties["api.dbus.ReserveDevice1"]
142 + if rd_name then
143 + rd_plugin:call("destroy-reservation", rd_name)
144 + end
145 +- end)
146 +- end
147 ++ end
148 ++ device_names_table[device.properties["device.name"]] = nil
149 ++ end)
150 ++
151 ++ -- reset the name tables to make sure names are recycled
152 ++ device_names_table = {}
153 ++ node_names_table = {}
154 +
155 + -- activate monitor
156 + Log.info("Activating ALSA monitor")
157 +--
158 +GitLab
159 +
160
161 diff --git a/media-video/wireplumber/files/wireplumber-0.4.10-m-lua-scripting-allow-converting-GValue-holding-NUL.patch b/media-video/wireplumber/files/wireplumber-0.4.10-m-lua-scripting-allow-converting-GValue-holding-NUL.patch
162 new file mode 100644
163 index 000000000000..c319ac4a617b
164 --- /dev/null
165 +++ b/media-video/wireplumber/files/wireplumber-0.4.10-m-lua-scripting-allow-converting-GValue-holding-NUL.patch
166 @@ -0,0 +1,36 @@
167 +https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/c2f31bb550755acba31da2e9f5bbdf646ed5e805
168 +
169 +From c2f31bb550755acba31da2e9f5bbdf646ed5e805 Mon Sep 17 00:00:00 2001
170 +From: Julian Bouzas <julian.bouzas@×××××××××.com>
171 +Date: Mon, 16 May 2022 15:41:10 -0400
172 +Subject: [PATCH] m-lua-scripting: allow converting GValue holding NULL objects
173 + to Lua
174 +
175 +---
176 + modules/module-lua-scripting/wplua/value.c | 9 +++++++--
177 + 1 file changed, 7 insertions(+), 2 deletions(-)
178 +
179 +diff --git a/modules/module-lua-scripting/wplua/value.c b/modules/module-lua-scripting/wplua/value.c
180 +index 133051a4..e31ae4ac 100644
181 +--- a/modules/module-lua-scripting/wplua/value.c
182 ++++ b/modules/module-lua-scripting/wplua/value.c
183 +@@ -314,9 +314,14 @@ wplua_gvalue_to_lua (lua_State *L, const GValue *v)
184 + wplua_pushboxed (L, G_VALUE_TYPE (v), g_value_dup_boxed (v));
185 + break;
186 + case G_TYPE_OBJECT:
187 +- case G_TYPE_INTERFACE:
188 +- wplua_pushobject (L, g_value_dup_object (v));
189 ++ case G_TYPE_INTERFACE: {
190 ++ GObject *object = g_value_dup_object (v);
191 ++ if (object)
192 ++ wplua_pushobject (L, g_value_dup_object (v));
193 ++ else
194 ++ lua_pushnil (L);
195 + break;
196 ++ }
197 + case G_TYPE_ENUM:
198 + wplua_enum_to_lua (L, g_value_get_enum (v), G_VALUE_TYPE (v));
199 + break;
200 +--
201 +GitLab
202 +
203
204 diff --git a/media-video/wireplumber/files/wireplumber-0.4.10-m-lua-scripting-fix-object-refcounting.patch b/media-video/wireplumber/files/wireplumber-0.4.10-m-lua-scripting-fix-object-refcounting.patch
205 new file mode 100644
206 index 000000000000..0b86979ce732
207 --- /dev/null
208 +++ b/media-video/wireplumber/files/wireplumber-0.4.10-m-lua-scripting-fix-object-refcounting.patch
209 @@ -0,0 +1,32 @@
210 +https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/7908b8d7be2a2992c57cd549054eda7ce46e4b44
211 +
212 +From 13b85bd4a25ab374f5e5e90b7288e6987996856e Mon Sep 17 00:00:00 2001
213 +From: Michael Olbrich <m.olbrich@×××××××××××.de>
214 +Date: Tue, 24 May 2022 11:35:15 +0200
215 +Subject: [PATCH] m-lua-scripting: fix object refcounting
216 +
217 +7908b8d7be2a2992c57cd549054eda7ce46e4b44 ("m-lua-scripting: allow
218 +converting GValue holding NULL objects to Lua") accidentally added a second
219 +refcount. As a result, the objects are never freeded.
220 +
221 +Remove the second refcount to fix this.
222 +---
223 + modules/module-lua-scripting/wplua/value.c | 2 +-
224 + 1 file changed, 1 insertion(+), 1 deletion(-)
225 +
226 +diff --git a/modules/module-lua-scripting/wplua/value.c b/modules/module-lua-scripting/wplua/value.c
227 +index e31ae4a..a7927dc 100644
228 +--- a/modules/module-lua-scripting/wplua/value.c
229 ++++ b/modules/module-lua-scripting/wplua/value.c
230 +@@ -317,7 +317,7 @@ wplua_gvalue_to_lua (lua_State *L, const GValue *v)
231 + case G_TYPE_INTERFACE: {
232 + GObject *object = g_value_dup_object (v);
233 + if (object)
234 +- wplua_pushobject (L, g_value_dup_object (v));
235 ++ wplua_pushobject (L, object);
236 + else
237 + lua_pushnil (L);
238 + break;
239 +--
240 +2.35.1
241 +
242
243 diff --git a/media-video/wireplumber/wireplumber-9999.ebuild b/media-video/wireplumber/wireplumber-0.4.10-r2.ebuild
244 similarity index 92%
245 copy from media-video/wireplumber/wireplumber-9999.ebuild
246 copy to media-video/wireplumber/wireplumber-0.4.10-r2.ebuild
247 index 9bae3695faf2..a3581508193e 100644
248 --- a/media-video/wireplumber/wireplumber-9999.ebuild
249 +++ b/media-video/wireplumber/wireplumber-0.4.10-r2.ebuild
250 @@ -13,7 +13,7 @@ if [[ ${PV} == 9999 ]]; then
251 inherit git-r3
252 else
253 SRC_URI="https://gitlab.freedesktop.org/pipewire/${PN}/-/archive/${PV}/${P}.tar.gz"
254 - KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
255 + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
256 fi
257
258 DESCRIPTION="Replacement for pipewire-media-session"
259 @@ -62,6 +62,12 @@ RDEPEND="${DEPEND}
260
261 DOCS=( {NEWS,README}.rst )
262
263 +PATCHES=(
264 + "${FILESDIR}"/${P}-m-lua-scripting-allow-converting-GValue-holding-NUL.patch
265 + "${FILESDIR}"/${P}-alsa.lua-fix-device-name-deduplication-when-reserva.patch
266 + "${FILESDIR}"/${P}-m-lua-scripting-fix-object-refcounting.patch
267 +)
268 +
269 src_configure() {
270 local emesonargs=(
271 -Ddoc=disabled # Ebuild not wired up yet (Sphinx, Doxygen?)
272
273 diff --git a/media-video/wireplumber/wireplumber-9999.ebuild b/media-video/wireplumber/wireplumber-9999.ebuild
274 index 9bae3695faf2..d231bfe704c3 100644
275 --- a/media-video/wireplumber/wireplumber-9999.ebuild
276 +++ b/media-video/wireplumber/wireplumber-9999.ebuild
277 @@ -13,7 +13,7 @@ if [[ ${PV} == 9999 ]]; then
278 inherit git-r3
279 else
280 SRC_URI="https://gitlab.freedesktop.org/pipewire/${PN}/-/archive/${PV}/${P}.tar.gz"
281 - KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
282 + KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
283 fi
284
285 DESCRIPTION="Replacement for pipewire-media-session"