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, 15 Sep 2021 17:06:55
Message-Id: 1631725571.282db130198575413021b639ded1afcec46a8cf0.sam@gentoo
1 commit: 282db130198575413021b639ded1afcec46a8cf0
2 Author: Niklāvs Koļesņikovs <89q1r14hd <AT> relay <DOT> firefox <DOT> com>
3 AuthorDate: Wed Sep 15 11:35:50 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 15 17:06:11 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=282db130
7
8 media-video/wireplumber: fix errors on missing BlueZ and V4L
9
10 Two of the commits have not yet been accepted upstream but they
11 were prepared with the help of upstream and should be in acceptably
12 good quality to use until a fixed release is made.
13
14 https://gitlab.freedesktop.org/pipewire/wireplumber/-/merge_requests/214
15
16 Thanks-to: Pascal Flöschel (initial bug report)
17 Thanks-to: George Kiagiadakis <george.kiagiadakis <AT> collabora.com>
18 Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=994085
19 Closes: https://bugs.gentoo.org/813043
20
21 Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd <AT> relay.firefox.com>
22 Closes: https://github.com/gentoo/gentoo/pull/22290
23 Signed-off-by: Sam James <sam <AT> gentoo.org>
24
25 ...4.2-bluez-add-basic-check-for-nil-monitor.patch | 42 +++++++++
26 ...ice-demote-missing-SPA-warning-to-message.patch | 28 ++++++
27 ...ix-object-constructors-to-fail-gracefully.patch | 100 +++++++++++++++++++++
28 ...0.4.2-v4l-add-basic-check-for-nil-monitor.patch | 42 +++++++++
29 .../wireplumber/wireplumber-0.4.2-r1.ebuild | 6 +-
30 5 files changed, 217 insertions(+), 1 deletion(-)
31
32 diff --git a/media-video/wireplumber/files/wireplumber-0.4.2-bluez-add-basic-check-for-nil-monitor.patch b/media-video/wireplumber/files/wireplumber-0.4.2-bluez-add-basic-check-for-nil-monitor.patch
33 new file mode 100644
34 index 00000000000..a519e421282
35 --- /dev/null
36 +++ b/media-video/wireplumber/files/wireplumber-0.4.2-bluez-add-basic-check-for-nil-monitor.patch
37 @@ -0,0 +1,42 @@
38 +From 32d96189b807ab53317a33217c661ce4b1ac8e49 Mon Sep 17 00:00:00 2001
39 +From: =?UTF-8?q?Nikl=C4=81vs=20Ko=C4=BCes=C5=86ikovs?=
40 + <89q1r14hd@×××××××××××××.com>
41 +Date: Wed, 15 Sep 2021 12:21:40 +0300
42 +Subject: [PATCH 3/5] bluez: add basic check for nil monitor
43 +MIME-Version: 1.0
44 +Content-Type: text/plain; charset=UTF-8
45 +Content-Transfer-Encoding: 8bit
46 +
47 +If PipeWire is built without Bluetooth support, then
48 +
49 +`monitor = SpaDevice("api.bluez5.enum.dbus", monitor_props)`
50 +
51 +will result in a nil monitor. This commit adds a basic sanity check
52 +to avoid further using the nil variable.
53 +
54 +Thanks-to: Pascal Flöschel (initial bug report)
55 +Thanks-to: George Kiagiadakis <george.kiagiadakis@×××××××××.com>
56 +Bug: https://bugs.gentoo.org/813043
57 +---
58 + src/scripts/monitors/bluez.lua | 8 ++++++--
59 + 1 file changed, 6 insertions(+), 2 deletions(-)
60 +
61 +diff --git a/src/scripts/monitors/bluez.lua b/src/scripts/monitors/bluez.lua
62 +index fc229fa..4066536 100644
63 +--- a/src/scripts/monitors/bluez.lua
64 ++++ b/src/scripts/monitors/bluez.lua
65 +@@ -129,5 +129,9 @@ local monitor_props = config.properties or {}
66 + monitor_props["api.bluez5.connection-info"] = true
67 +
68 + monitor = SpaDevice("api.bluez5.enum.dbus", monitor_props)
69 +-monitor:connect("create-object", createDevice)
70 +-monitor:activate(Feature.SpaDevice.ENABLED)
71 ++if monitor then
72 ++ monitor:connect("create-object", createDevice)
73 ++ monitor:activate(Feature.SpaDevice.ENABLED)
74 ++else
75 ++ Log.message("PipeWire's BlueZ SPA missing or broken. Bluetooth not supported.")
76 ++end
77 +--
78 +2.33.0
79 +
80
81 diff --git a/media-video/wireplumber/files/wireplumber-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch b/media-video/wireplumber/files/wireplumber-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch
82 new file mode 100644
83 index 00000000000..7653de28bbb
84 --- /dev/null
85 +++ b/media-video/wireplumber/files/wireplumber-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch
86 @@ -0,0 +1,28 @@
87 +From 05334c1ec72af68f915ea18e32b230857918f600 Mon Sep 17 00:00:00 2001
88 +From: =?UTF-8?q?Nikl=C4=81vs=20Ko=C4=BCes=C5=86ikovs?=
89 + <89q1r14hd@×××××××××××××.com>
90 +Date: Wed, 15 Sep 2021 13:23:45 +0300
91 +Subject: [PATCH 5/5] lib/wp/device: demote missing SPA warning to message
92 +
93 +Warnings can be scary, so best not to scare users with what's likely
94 +intentional omission of a particular SPA plugin (currently V4L & BlueZ).
95 +---
96 + lib/wp/device.c | 2 +-
97 + 1 file changed, 1 insertion(+), 1 deletion(-)
98 +
99 +diff --git a/lib/wp/device.c b/lib/wp/device.c
100 +index f0c32af..9a0b995 100644
101 +--- a/lib/wp/device.c
102 ++++ b/lib/wp/device.c
103 +@@ -617,7 +617,7 @@ wp_spa_device_new_from_spa_factory (WpCore * core,
104 + handle = pw_context_load_spa_handle (pw_context, factory_name,
105 + props ? wp_properties_peek_dict (props) : NULL);
106 + if (!handle) {
107 +- wp_warning ("SPA handle '%s' could not be loaded; is it installed?",
108 ++ wp_message ("SPA handle '%s' could not be loaded; is it installed?",
109 + factory_name);
110 + return NULL;
111 + }
112 +--
113 +2.33.0
114 +
115
116 diff --git a/media-video/wireplumber/files/wireplumber-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch b/media-video/wireplumber/files/wireplumber-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch
117 new file mode 100644
118 index 00000000000..2bb3a8d653e
119 --- /dev/null
120 +++ b/media-video/wireplumber/files/wireplumber-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch
121 @@ -0,0 +1,100 @@
122 +From 2a5f9c51f2f8dd29cd19a14f165ca2b425a172fc Mon Sep 17 00:00:00 2001
123 +From: George Kiagiadakis <george.kiagiadakis@×××××××××.com>
124 +Date: Wed, 15 Sep 2021 12:51:47 +0300
125 +Subject: [PATCH 2/5] lua/api: fix object constructors to fail gracefully
126 +
127 +---
128 + modules/module-lua-scripting/api.c | 35 ++++++++++++++++++------------
129 + 1 file changed, 21 insertions(+), 14 deletions(-)
130 +
131 +diff --git a/modules/module-lua-scripting/api.c b/modules/module-lua-scripting/api.c
132 +index 5691b63..2830477 100644
133 +--- a/modules/module-lua-scripting/api.c
134 ++++ b/modules/module-lua-scripting/api.c
135 +@@ -836,8 +836,9 @@ device_new (lua_State *L)
136 +
137 + WpDevice *d = wp_device_new_from_factory (get_wp_export_core (L),
138 + factory, properties);
139 +- wplua_pushobject (L, d);
140 +- return 1;
141 ++ if (d)
142 ++ wplua_pushobject (L, d);
143 ++ return d ? 1 : 0;
144 + }
145 +
146 + /* WpSpaDevice */
147 +@@ -855,8 +856,9 @@ spa_device_new (lua_State *L)
148 +
149 + WpSpaDevice *d = wp_spa_device_new_from_spa_factory (get_wp_export_core (L),
150 + factory, properties);
151 +- wplua_pushobject (L, d);
152 +- return 1;
153 ++ if (d)
154 ++ wplua_pushobject (L, d);
155 ++ return d ? 1 : 0;
156 + }
157 +
158 + static int
159 +@@ -903,8 +905,9 @@ node_new (lua_State *L)
160 +
161 + WpNode *d = wp_node_new_from_factory (get_wp_export_core (L),
162 + factory, properties);
163 +- wplua_pushobject (L, d);
164 +- return 1;
165 ++ if (d)
166 ++ wplua_pushobject (L, d);
167 ++ return d ? 1 : 0;
168 + }
169 +
170 + static int
171 +@@ -1011,8 +1014,9 @@ impl_node_new (lua_State *L)
172 +
173 + WpImplNode *d = wp_impl_node_new_from_pw_factory (get_wp_export_core (L),
174 + factory, properties);
175 +- wplua_pushobject (L, d);
176 +- return 1;
177 ++ if (d)
178 ++ wplua_pushobject (L, d);
179 ++ return d ? 1 : 0;
180 + }
181 +
182 + /* Port */
183 +@@ -1045,8 +1049,9 @@ link_new (lua_State *L)
184 + }
185 +
186 + WpLink *l = wp_link_new_from_factory (get_wp_core (L), factory, properties);
187 +- wplua_pushobject (L, l);
188 +- return 1;
189 ++ if (l)
190 ++ wplua_pushobject (L, l);
191 ++ return l ? 1 : 0;
192 + }
193 +
194 + /* Client */
195 +@@ -1124,8 +1129,9 @@ session_item_new (lua_State *L)
196 + {
197 + const char *type = luaL_checkstring (L, 1);
198 + WpSessionItem *si = wp_session_item_make (get_wp_core (L), type);
199 +- wplua_pushobject (L, si);
200 +- return 1;
201 ++ if (si)
202 ++ wplua_pushobject (L, si);
203 ++ return si ? 1 : 0;
204 + }
205 +
206 + static int
207 +@@ -1135,8 +1141,9 @@ session_item_get_associated_proxy (lua_State *L)
208 + const char *typestr = luaL_checkstring (L, 2);
209 + WpProxy *proxy = wp_session_item_get_associated_proxy (si,
210 + parse_gtype (typestr));
211 +- wplua_pushobject (L, proxy);
212 +- return 1;
213 ++ if (proxy)
214 ++ wplua_pushobject (L, proxy);
215 ++ return proxy ? 1 : 0;
216 + }
217 +
218 + static int
219 +--
220 +2.33.0
221 +
222
223 diff --git a/media-video/wireplumber/files/wireplumber-0.4.2-v4l-add-basic-check-for-nil-monitor.patch b/media-video/wireplumber/files/wireplumber-0.4.2-v4l-add-basic-check-for-nil-monitor.patch
224 new file mode 100644
225 index 00000000000..f7fee3d11e4
226 --- /dev/null
227 +++ b/media-video/wireplumber/files/wireplumber-0.4.2-v4l-add-basic-check-for-nil-monitor.patch
228 @@ -0,0 +1,42 @@
229 +From 3b41df35a885b4db04528d839b87e88bf1345240 Mon Sep 17 00:00:00 2001
230 +From: =?UTF-8?q?Nikl=C4=81vs=20Ko=C4=BCes=C5=86ikovs?=
231 + <89q1r14hd@×××××××××××××.com>
232 +Date: Wed, 15 Sep 2021 13:08:04 +0300
233 +Subject: [PATCH 4/5] v4l: add basic check for nil monitor
234 +MIME-Version: 1.0
235 +Content-Type: text/plain; charset=UTF-8
236 +Content-Transfer-Encoding: 8bit
237 +
238 +If PipeWire is built without V4L support, then
239 +
240 +`monitor = SpaDevice("api.v4l2.enum.udev", config.properties or {})`
241 +
242 +will result in a nil monitor. This commit adds a basic sanity check
243 +to avoid further using the nil variable.
244 +
245 +Thanks-to: Pascal Flöschel (initial bug report)
246 +Thanks-to: George Kiagiadakis <george.kiagiadakis@×××××××××.com>
247 +Bug: https://bugs.gentoo.org/813043
248 +---
249 + src/scripts/monitors/v4l2.lua | 8 ++++++--
250 + 1 file changed, 6 insertions(+), 2 deletions(-)
251 +
252 +diff --git a/src/scripts/monitors/v4l2.lua b/src/scripts/monitors/v4l2.lua
253 +index e698cd7..fd9a20d 100644
254 +--- a/src/scripts/monitors/v4l2.lua
255 ++++ b/src/scripts/monitors/v4l2.lua
256 +@@ -131,5 +131,9 @@ function createDevice(parent, id, type, factory, properties)
257 + end
258 +
259 + monitor = SpaDevice("api.v4l2.enum.udev", config.properties or {})
260 +-monitor:connect("create-object", createDevice)
261 +-monitor:activate(Feature.SpaDevice.ENABLED)
262 ++if monitor then
263 ++ monitor:connect("create-object", createDevice)
264 ++ monitor:activate(Feature.SpaDevice.ENABLED)
265 ++else
266 ++ Log.message("PipeWire's V4L SPA missing or broken. Video4Linux not supported.")
267 ++end
268 +--
269 +2.33.0
270 +
271
272 diff --git a/media-video/wireplumber/wireplumber-0.4.2-r1.ebuild b/media-video/wireplumber/wireplumber-0.4.2-r1.ebuild
273 index ed677c4b5aa..a52dbd45471 100644
274 --- a/media-video/wireplumber/wireplumber-0.4.2-r1.ebuild
275 +++ b/media-video/wireplumber/wireplumber-0.4.2-r1.ebuild
276 @@ -51,7 +51,11 @@ RDEPEND="${DEPEND}"
277 DOCS=( {NEWS,README}.rst )
278
279 PATCHES=(
280 - "${FILESDIR}"/${PN}-0.4.2-meson-Build-tests-conditionally.patch
281 + "${FILESDIR}"/${PN}-0.4.2-meson-Build-tests-conditionally.patch
282 + "${FILESDIR}"/${PN}-0.4.2-lua-api-fix-object-constructors-to-fail-gracefully.patch
283 + "${FILESDIR}"/${PN}-0.4.2-bluez-add-basic-check-for-nil-monitor.patch
284 + "${FILESDIR}"/${PN}-0.4.2-v4l-add-basic-check-for-nil-monitor.patch
285 + "${FILESDIR}"/${PN}-0.4.2-lib-wp-device-demote-missing-SPA-warning-to-message.patch
286 )
287
288 src_configure() {