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/files/, media-video/wireplumber/
Date: Wed, 01 Dec 2021 19:49:52
Message-Id: 1638388181.f14cc9569d7591317f868b9359232a8ddafb76e5.sam@gentoo
1 commit: f14cc9569d7591317f868b9359232a8ddafb76e5
2 Author: Niklāvs Koļesņikovs <89q1r14hd <AT> relay <DOT> firefox <DOT> com>
3 AuthorDate: Fri Nov 19 08:07:46 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 1 19:49:41 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f14cc956
7
8 media-video/wireplumber: apply multiple important looking fixes
9
10 Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd <AT> relay.firefox.com>
11 Closes: https://github.com/gentoo/gentoo/pull/23001
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 ...-alsa-handle-the-release-requested-signal.patch | 33 ++++++++
15 ...ead-hidden-files-from-the-config-director.patch | 27 ++++++
16 ...evice-replace-the-hash-table-key-on-new-i.patch | 47 +++++++++++
17 ...de-wait-for-nodes-when-we-become-unlinked.patch | 34 ++++++++
18 .../wireplumber/wireplumber-0.4.5-r1.ebuild | 96 ++++++++++++++++++++++
19 5 files changed, 237 insertions(+)
20
21 diff --git a/media-video/wireplumber/files/wireplumber-0.4.5-alsa-handle-the-release-requested-signal.patch b/media-video/wireplumber/files/wireplumber-0.4.5-alsa-handle-the-release-requested-signal.patch
22 new file mode 100644
23 index 000000000000..511dc6df377e
24 --- /dev/null
25 +++ b/media-video/wireplumber/files/wireplumber-0.4.5-alsa-handle-the-release-requested-signal.patch
26 @@ -0,0 +1,33 @@
27 +From efd24584182903bf5ee4660a3b3360cc47ad895b Mon Sep 17 00:00:00 2001
28 +From: Wim Taymans <wtaymans@××××××.com>
29 +Date: Tue, 23 Nov 2021 13:17:29 +0100
30 +Subject: [PATCH] alsa: handle the release-requested signal
31 +
32 +Handle the release-requested signal by destroying the device and
33 +then calling release.
34 +
35 +Fixes pipewire/pipewire#1846
36 +---
37 + src/scripts/monitors/alsa.lua | 6 ++++++
38 + 1 file changed, 6 insertions(+)
39 +
40 +diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua
41 +index 68c39d8..be4648e 100644
42 +--- a/src/scripts/monitors/alsa.lua
43 ++++ b/src/scripts/monitors/alsa.lua
44 +@@ -287,6 +287,12 @@ function prepareDevice(parent, id, type, factory, properties)
45 + end
46 + end)
47 +
48 ++ rd:connect("release-requested", function (rd)
49 ++ Log.info("release requested")
50 ++ parent:store_managed_object(id, nil)
51 ++ rd:call("release")
52 ++ end)
53 ++
54 + if jack_device then
55 + rd:connect("notify::owner-name-changed", function (rd, pspec)
56 + if rd["state"] == "busy" and
57 +--
58 +2.34.1
59 +
60
61 diff --git a/media-video/wireplumber/files/wireplumber-0.4.5-lib-don-t-read-hidden-files-from-the-config-director.patch b/media-video/wireplumber/files/wireplumber-0.4.5-lib-don-t-read-hidden-files-from-the-config-director.patch
62 new file mode 100644
63 index 000000000000..1554c65e27da
64 --- /dev/null
65 +++ b/media-video/wireplumber/files/wireplumber-0.4.5-lib-don-t-read-hidden-files-from-the-config-director.patch
66 @@ -0,0 +1,27 @@
67 +From ee5f3f2f195b01fd89ee148da5799b02f99ebb6e Mon Sep 17 00:00:00 2001
68 +From: Peter Hutterer <peter.hutterer@×××××.net>
69 +Date: Sun, 14 Nov 2021 19:44:30 +1000
70 +Subject: [PATCH 3/3] lib: don't read hidden files from the config directory
71 +
72 +Fixes #104
73 +---
74 + lib/wp/wp.c | 3 +++
75 + 1 file changed, 3 insertions(+)
76 +
77 +diff --git a/lib/wp/wp.c b/lib/wp/wp.c
78 +index ffdff1a..c356133 100644
79 +--- a/lib/wp/wp.c
80 ++++ b/lib/wp/wp.c
81 +@@ -315,6 +315,9 @@ wp_new_files_iterator (WpLookupDirs dirs, const gchar *subdir,
82 + if (dir) {
83 + const gchar *filename;
84 + while ((filename = g_dir_read_name (dir))) {
85 ++ if (filename[0] == '.')
86 ++ continue;
87 ++
88 + if (suffix && !g_str_has_suffix (filename, suffix))
89 + continue;
90 +
91 +--
92 +2.34.0
93 +
94
95 diff --git a/media-video/wireplumber/files/wireplumber-0.4.5-m-reserve-device-replace-the-hash-table-key-on-new-i.patch b/media-video/wireplumber/files/wireplumber-0.4.5-m-reserve-device-replace-the-hash-table-key-on-new-i.patch
96 new file mode 100644
97 index 000000000000..70d69093d082
98 --- /dev/null
99 +++ b/media-video/wireplumber/files/wireplumber-0.4.5-m-reserve-device-replace-the-hash-table-key-on-new-i.patch
100 @@ -0,0 +1,47 @@
101 +From f4546a18e871537be698916178b40091a4a0b377 Mon Sep 17 00:00:00 2001
102 +From: Peter Hutterer <peter.hutterer@×××××.net>
103 +Date: Fri, 12 Nov 2021 11:19:54 +1000
104 +Subject: [PATCH 3/3] m-reserve-device: replace the hash table key on new
105 + insert
106 +
107 +We're using the WpReserveDevice's name as key in the hash table, so we
108 +must update the key as well when we replace an item in the hashtable -
109 +the old device (and its name) will be released.
110 +
111 +The side-effect of this is that the *third* device with an identical
112 +name will no longer replace the previous device. This results in the
113 +following sequence:
114 +
115 +- dev1 added: name Audio0
116 + - dev1 requests name owner Audio0
117 +- dev2 added: name Audio0
118 + - replace dev1 in the hashtable
119 + - dev1 emits "release" signal
120 + - dev1 unowns the Audio0 name
121 + - dev2 requests name owner Audio0
122 +- dev3 added: name Audio0
123 + - adds to the hashtable because the existing key is now undefined
124 + - dev3 requests name owner Audio0
125 + - error, you cannot request ownership for the same name twice
126 +
127 +Fixes #93
128 +---
129 + modules/module-reserve-device/plugin.c | 2 +-
130 + 1 file changed, 1 insertion(+), 1 deletion(-)
131 +
132 +diff --git a/modules/module-reserve-device/plugin.c b/modules/module-reserve-device/plugin.c
133 +index d8e4e09..68df6ee 100644
134 +--- a/modules/module-reserve-device/plugin.c
135 ++++ b/modules/module-reserve-device/plugin.c
136 +@@ -221,7 +221,7 @@ wp_reserve_device_plugin_create_reservation (WpReserveDevicePlugin *self,
137 + NULL);
138 +
139 + /* use rd->name to avoid copying @em name again */
140 +- g_hash_table_insert (self->reserve_devices, rd->name, rd);
141 ++ g_hash_table_replace (self->reserve_devices, rd->name, rd);
142 +
143 + return g_object_ref (rd);
144 + }
145 +--
146 +2.34.0
147 +
148
149 diff --git a/media-video/wireplumber/files/wireplumber-0.4.5-policy-node-wait-for-nodes-when-we-become-unlinked.patch b/media-video/wireplumber/files/wireplumber-0.4.5-policy-node-wait-for-nodes-when-we-become-unlinked.patch
150 new file mode 100644
151 index 000000000000..0ce16a647697
152 --- /dev/null
153 +++ b/media-video/wireplumber/files/wireplumber-0.4.5-policy-node-wait-for-nodes-when-we-become-unlinked.patch
154 @@ -0,0 +1,34 @@
155 +From 83041b0ce277c95afaf1824f525ea0bec516f03f Mon Sep 17 00:00:00 2001
156 +From: Wim Taymans <wtaymans@××××××.com>
157 +Date: Thu, 18 Nov 2021 15:23:23 +0100
158 +Subject: [PATCH 2/3] policy-node: wait for nodes when we become unlinked
159 +
160 +If we were linked before but our node is removed, wait until a new node
161 +becomes available instead of failing.
162 +
163 +This fixes an issue where there is only 1 sink available and the card
164 +profile is toggeled between pro and stereo. After the profile is
165 +toggled, the sink is removed and the node would be killed with an error
166 +because there is no fallback sink. The fix is similar to the
167 +pipewire-media-session logic.
168 +---
169 + src/scripts/policy-node.lua | 3 +++
170 + 1 file changed, 3 insertions(+)
171 +
172 +diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua
173 +index 5029d1b..445b1a7 100644
174 +--- a/src/scripts/policy-node.lua
175 ++++ b/src/scripts/policy-node.lua
176 +@@ -493,6 +493,9 @@ function handleLinkable (si)
177 + if not reconnect then
178 + Log.info (si, "... destroy node")
179 + node:request_destroy()
180 ++ elseif si_flags[si.id].was_handled then
181 ++ Log.info (si, "... waiting reconnect")
182 ++ return
183 + end
184 +
185 + local client_id = node.properties["client.id"]
186 +--
187 +2.34.0
188 +
189
190 diff --git a/media-video/wireplumber/wireplumber-0.4.5-r1.ebuild b/media-video/wireplumber/wireplumber-0.4.5-r1.ebuild
191 new file mode 100644
192 index 000000000000..977f3e5b79a7
193 --- /dev/null
194 +++ b/media-video/wireplumber/wireplumber-0.4.5-r1.ebuild
195 @@ -0,0 +1,96 @@
196 +# Copyright 1999-2021 Gentoo Authors
197 +# Distributed under the terms of the GNU General Public License v2
198 +
199 +EAPI=7
200 +
201 +LUA_COMPAT=( lua5-{3,4} )
202 +
203 +inherit lua-single meson systemd
204 +
205 +if [[ ${PV} == 9999 ]]; then
206 + EGIT_REPO_URI="https://gitlab.freedesktop.org/pipewire/${PN}.git"
207 + EGIT_BRANCH="master"
208 + inherit git-r3
209 +else
210 + SRC_URI="https://gitlab.freedesktop.org/pipewire/${PN}/-/archive/${PV}/${P}.tar.gz"
211 + KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
212 +fi
213 +
214 +DESCRIPTION="Replacement for pipewire-media-session"
215 +HOMEPAGE="https://gitlab.freedesktop.org/pipewire/wireplumber"
216 +
217 +LICENSE="MIT"
218 +SLOT="0/0.4"
219 +IUSE="elogind systemd test"
220 +
221 +REQUIRED_USE="
222 + ${LUA_REQUIRED_USE}
223 + ?? ( elogind systemd )
224 +"
225 +
226 +RESTRICT="!test? ( test )"
227 +
228 +# introspection? ( dev-libs/gobject-introspection ) is valid but likely only used for doc building
229 +BDEPEND="
230 + dev-libs/glib
231 + dev-util/gdbus-codegen
232 + dev-util/glib-utils
233 +"
234 +
235 +DEPEND="
236 + ${LUA_DEPS}
237 + >=dev-libs/glib-2.62
238 + >=media-video/pipewire-0.3.39
239 + virtual/libc
240 + elogind? ( sys-auth/elogind )
241 + systemd? ( sys-apps/systemd )
242 +"
243 +
244 +# Any dev-lua/* deps get declared like this inside RDEPEND:
245 +# $(lua_gen_cond_dep '
246 +# dev-lua/<NAME>[${LUA_USEDEP}]
247 +# ')
248 +RDEPEND="${DEPEND}"
249 +
250 +DOCS=( {NEWS,README}.rst )
251 +
252 +PATCHES=(
253 + "${FILESDIR}"/${PN}-0.4.5-m-reserve-device-replace-the-hash-table-key-on-new-i.patch
254 + "${FILESDIR}"/${PN}-0.4.5-policy-node-wait-for-nodes-when-we-become-unlinked.patch
255 + "${FILESDIR}"/${PN}-0.4.5-lib-don-t-read-hidden-files-from-the-config-director.patch
256 + "${FILESDIR}"/${PN}-0.4.5-alsa-handle-the-release-requested-signal.patch
257 +)
258 +
259 +src_configure() {
260 + local emesonargs=(
261 + -Dintrospection=disabled # Only used for Sphinx doc generation
262 + -Dsystem-lua=true # We always unbundle everything we can
263 + -Dsystem-lua-version=$(ver_cut 1-2 $(lua_get_version))
264 + $(meson_feature elogind)
265 + $(meson_feature systemd)
266 + -Dsystemd-system-service=false # Matches upstream
267 + $(meson_use systemd systemd-user-service)
268 + -Dsystemd-system-unit-dir=$(systemd_get_systemunitdir)
269 + -Dsystemd-user-unit-dir=$(systemd_get_userunitdir)
270 + $(meson_use test tests)
271 + )
272 +
273 + meson_src_configure
274 +}
275 +
276 +pkg_postinst() {
277 + if systemd_is_booted ; then
278 + ewarn "pipewire-media-session.service is no longer installed. You must switch"
279 + ewarn "to wireplumber.service user unit before your next logout/reboot:"
280 + ewarn "systemctl --user disable pipewire-media-session.service"
281 + ewarn "systemctl --user --force enable wireplumber.service"
282 + else
283 + ewarn "Switch to WirePlumber will happen the next time gentoo-pipewire-launcher"
284 + ewarn "is started (a replacement for directly calling pipewire binary)."
285 + ewarn
286 + ewarn "Please ensure that ${EROOT}/etc/pipewire/pipewire.conf either does not exist"
287 + ewarn "or, if it does exist, that any reference to"
288 + ewarn "${EROOT}/usr/bin/pipewire-media-session is commented out (begins with a #)."
289 + fi
290 + ewarn
291 +}