Gentoo Archives: gentoo-commits

From: Mart Raudsepp <leio@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/pulseaudio-daemon/, media-sound/pulseaudio-daemon/files/
Date: Tue, 29 Nov 2022 07:13:36
Message-Id: 1669705696.38919a9dc42d975a5966c3dacb61c19995993109.leio@gentoo
1 commit: 38919a9dc42d975a5966c3dacb61c19995993109
2 Author: Igor V. Kovalenko <igor.v.kovalenko <AT> gmail <DOT> com>
3 AuthorDate: Sun Nov 27 20:11:11 2022 +0000
4 Commit: Mart Raudsepp <leio <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 29 07:08:16 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=38919a9d
7
8 media-sound/pulseaudio-daemon: Fix module-combine-sink crashes
9
10 Upstream commits:
11 37c72c20720d6f7fefeeb151f5e10c2cd0dda30e
12 0cbbc408aee2b5f2c42280d24dc615405387b5b1
13
14 Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko <AT> gmail.com>
15 Closes: https://github.com/gentoo/gentoo/pull/28452
16 Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>
17
18 ...audio-16.1-module-combine-sink-load-crash.patch | 26 ++
19 ...dio-16.1-module-combine-sink-unload-crash.patch | 22 ++
20 .../pulseaudio-daemon-16.1-r1.ebuild | 395 +++++++++++++++++++++
21 3 files changed, 443 insertions(+)
22
23 diff --git a/media-sound/pulseaudio-daemon/files/pulseaudio-16.1-module-combine-sink-load-crash.patch b/media-sound/pulseaudio-daemon/files/pulseaudio-16.1-module-combine-sink-load-crash.patch
24 new file mode 100644
25 index 000000000000..d02c1029f8b0
26 --- /dev/null
27 +++ b/media-sound/pulseaudio-daemon/files/pulseaudio-16.1-module-combine-sink-load-crash.patch
28 @@ -0,0 +1,26 @@
29 +commit 37c72c20720d6f7fefeeb151f5e10c2cd0dda30e
30 +Author: Igor V. Kovalenko <igor.v.kovalenko@×××××.com>
31 +Date: Sun Nov 27 22:30:45 2022 +0300
32 +
33 + module-combine-sink: Do not set up rate adjustment timer at load time
34 +
35 + Rate adjustment timer is set up when combine sink is resumed and relased when
36 + combine sink is suspended. Do not create this timer again while module is loaded
37 + to prevent duplicate effort causing assertion in time_callback.
38 +
39 + Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/756>
40 +
41 +diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c
42 +index f98f4820b..4b7690183 100644
43 +--- a/src/modules/module-combine-sink.c
44 ++++ b/src/modules/module-combine-sink.c
45 +@@ -1711,9 +1711,6 @@ int pa__init(pa_module*m) {
46 + PA_IDXSET_FOREACH(o, u->outputs, idx)
47 + output_verify(o);
48 +
49 +- if (u->adjust_time > 0)
50 +- u->time_event = pa_core_rttime_new(m->core, pa_rtclock_now() + u->adjust_time, time_callback, u);
51 +-
52 + pa_modargs_free(ma);
53 +
54 + return 0;
55
56 diff --git a/media-sound/pulseaudio-daemon/files/pulseaudio-16.1-module-combine-sink-unload-crash.patch b/media-sound/pulseaudio-daemon/files/pulseaudio-16.1-module-combine-sink-unload-crash.patch
57 new file mode 100644
58 index 000000000000..f0cd82dde16e
59 --- /dev/null
60 +++ b/media-sound/pulseaudio-daemon/files/pulseaudio-16.1-module-combine-sink-unload-crash.patch
61 @@ -0,0 +1,22 @@
62 +commit 0cbbc408aee2b5f2c42280d24dc615405387b5b1
63 +Author: Igor V. Kovalenko <igor.v.kovalenko@×××××.com>
64 +Date: Sun Nov 27 19:39:23 2022 +0300
65 +
66 + module-combine-sink: Suspend while unloading to fix crash moving sinks
67 +
68 + Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/756>
69 +
70 +diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c
71 +index 4b7690183..2ccd9eb13 100644
72 +--- a/src/modules/module-combine-sink.c
73 ++++ b/src/modules/module-combine-sink.c
74 +@@ -1733,6 +1733,9 @@ void pa__done(pa_module*m) {
75 + if (!(u = m->userdata))
76 + return;
77 +
78 ++ if (u->sink && PA_SINK_IS_LINKED(u->sink->state))
79 ++ pa_sink_suspend(u->sink, true, PA_SUSPEND_UNAVAILABLE);
80 ++
81 + pa_strlist_free(u->unlinked_slaves);
82 +
83 + if (u->sink_put_slot)
84
85 diff --git a/media-sound/pulseaudio-daemon/pulseaudio-daemon-16.1-r1.ebuild b/media-sound/pulseaudio-daemon/pulseaudio-daemon-16.1-r1.ebuild
86 new file mode 100644
87 index 000000000000..8ccca2d552d5
88 --- /dev/null
89 +++ b/media-sound/pulseaudio-daemon/pulseaudio-daemon-16.1-r1.ebuild
90 @@ -0,0 +1,395 @@
91 +# Copyright 1999-2022 Gentoo Authors
92 +# Distributed under the terms of the GNU General Public License v2
93 +
94 +EAPI="7"
95 +
96 +MY_PV="${PV/_pre*}"
97 +MY_P="pulseaudio-${MY_PV}"
98 +inherit bash-completion-r1 gnome2-utils meson optfeature systemd tmpfiles udev
99 +
100 +DESCRIPTION="Daemon component of PulseAudio (networked sound server)"
101 +HOMEPAGE="https://www.freedesktop.org/wiki/Software/PulseAudio/"
102 +
103 +if [[ ${PV} = 9999 ]]; then
104 + inherit git-r3
105 + EGIT_BRANCH="master"
106 + EGIT_REPO_URI="https://gitlab.freedesktop.org/pulseaudio/pulseaudio"
107 +else
108 + SRC_URI="https://freedesktop.org/software/pulseaudio/releases/${MY_P}.tar.xz"
109 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
110 +fi
111 +
112 +S="${WORKDIR}/${MY_P}"
113 +
114 +# libpulse-simple and libpulse link to libpulse-core; this is daemon's
115 +# library and can link to gdbm and other GPL-only libraries. In this
116 +# cases, we have a fully GPL-2 package. Leaving the rest of the
117 +# GPL-forcing USE flags for those who use them.
118 +LICENSE="!gdbm? ( LGPL-2.1 ) gdbm? ( GPL-2 )"
119 +
120 +SLOT="0"
121 +
122 +# +alsa-plugin as discussed in bug #519530
123 +# TODO: Find out why webrtc-aec is + prefixed - there's already the always available speexdsp-aec
124 +# NOTE: The current ebuild sets +X almost certainly just for the pulseaudio.desktop file
125 +IUSE="+alsa +alsa-plugin aptx +asyncns bluetooth dbus elogind equalizer fftw +gdbm +glib gstreamer jack ldac lirc
126 +ofono-headset +orc oss selinux sox ssl systemd system-wide tcpd test +udev valgrind +webrtc-aec +X zeroconf"
127 +
128 +RESTRICT="!test? ( test )"
129 +
130 +# See "*** BLUEZ support not found (requires D-Bus)" in configure.ac
131 +# Basically all IUSE are either ${MULTILIB_USEDEP} for client libs or they belong under !daemon ()
132 +# We duplicate alsa-plugin, {native,ofono}-headset under daemon to let users deal with them at once
133 +REQUIRED_USE="
134 + ?? ( elogind systemd )
135 + alsa-plugin? ( alsa )
136 + aptx? ( bluetooth )
137 + bluetooth? ( dbus )
138 + equalizer? ( dbus )
139 + ldac? ( bluetooth )
140 + ofono-headset? ( bluetooth )
141 + udev? ( || ( alsa oss ) )
142 + zeroconf? ( dbus )
143 +"
144 +
145 +# NOTE:
146 +# - libpcre needed in some cases, bug #472228
147 +# - media-libs/speexdsp is providing echo canceller implementation and used in resampler
148 +# TODO: libatomic_ops is only needed on some architectures and conditions, and then at runtime too
149 +gstreamer_deps="
150 + media-libs/gst-plugins-base
151 + >=media-libs/gstreamer-1.14
152 +"
153 +COMMON_DEPEND="
154 + ~media-libs/libpulse-${PV}[dbus?,glib?,systemd?,valgrind?,X?]
155 + dev-libs/libatomic_ops
156 + >=media-libs/libsndfile-1.0.20
157 + >=media-libs/speexdsp-1.2
158 + || (
159 + elibc_glibc? ( virtual/libc )
160 + dev-libs/libpcre:3
161 + )
162 + alsa? ( >=media-libs/alsa-lib-1.0.24 )
163 + aptx? ( ${gstreamer_deps} )
164 + asyncns? ( >=net-libs/libasyncns-0.1 )
165 + bluetooth? (
166 + >=net-wireless/bluez-5
167 + media-libs/sbc
168 + )
169 + dev-libs/libltdl
170 + sys-kernel/linux-headers
171 + >=sys-libs/libcap-2.22-r2
172 + dbus? ( >=sys-apps/dbus-1.4.12 )
173 + elogind? ( sys-auth/elogind )
174 + equalizer? (
175 + sci-libs/fftw:3.0=
176 + )
177 + fftw? (
178 + sci-libs/fftw:3.0=
179 + )
180 + gdbm? ( sys-libs/gdbm:= )
181 + glib? ( >=dev-libs/glib-2.28.0:2 )
182 + gstreamer? (
183 + ${gstreamer_deps}
184 + >=dev-libs/glib-2.26.0:2
185 + )
186 + jack? ( virtual/jack )
187 + ldac? ( ${gstreamer_deps} )
188 + lirc? ( app-misc/lirc )
189 + ofono-headset? ( >=net-misc/ofono-1.13 )
190 + orc? ( >=dev-lang/orc-0.4.15 )
191 + selinux? ( sec-policy/selinux-pulseaudio )
192 + sox? ( >=media-libs/soxr-0.1.1 )
193 + ssl? ( dev-libs/openssl:= )
194 + systemd? ( sys-apps/systemd:= )
195 + tcpd? ( sys-apps/tcp-wrappers )
196 + udev? ( >=virtual/udev-143[hwdb(+)] )
197 + valgrind? ( dev-util/valgrind )
198 + webrtc-aec? ( >=media-libs/webrtc-audio-processing-0.2:0 )
199 + X? (
200 + >=x11-libs/libxcb-1.6
201 + x11-libs/libICE
202 + x11-libs/libSM
203 + >=x11-libs/libX11-1.4.0
204 + >=x11-libs/libXtst-1.0.99.2
205 + )
206 + zeroconf? ( >=net-dns/avahi-0.6.12[dbus] )
207 + !<media-sound/pulseaudio-15.0-r100
208 +"
209 +
210 +# pulseaudio ships a bundle xmltoman, which uses XML::Parser
211 +DEPEND="
212 + ${COMMON_DEPEND}
213 + test? ( >=dev-libs/check-0.9.10 )
214 + X? ( x11-base/xorg-proto )
215 +"
216 +
217 +# alsa-utils dep is for the alsasound init.d script (see bug 155707); TODO: read it
218 +# NOTE: Only system-wide needs acct-group/audio unless elogind/systemd is not used
219 +RDEPEND="
220 + ${COMMON_DEPEND}
221 + system-wide? (
222 + alsa? ( media-sound/alsa-utils )
223 + acct-user/pulse
224 + acct-group/audio
225 + acct-group/pulse-access
226 + )
227 + bluetooth? (
228 + ldac? ( media-plugins/gst-plugins-ldac )
229 + aptx? ( media-plugins/gst-plugins-openaptx )
230 + )
231 + !media-video/pipewire[sound-server(+)]
232 +"
233 +unset gstreamer_deps
234 +
235 +# This is a PDEPEND to avoid a circular dep
236 +PDEPEND="
237 + alsa? ( alsa-plugin? ( >=media-plugins/alsa-plugins-1.0.27-r1[pulseaudio] ) )
238 +"
239 +
240 +BDEPEND="
241 + dev-lang/perl
242 + dev-perl/XML-Parser
243 + sys-devel/gettext
244 + virtual/libiconv
245 + virtual/libintl
246 + virtual/pkgconfig
247 + orc? ( >=dev-lang/orc-0.4.15 )
248 + system-wide? ( dev-util/unifdef )
249 +"
250 +
251 +DOCS=( NEWS README )
252 +
253 +S="${WORKDIR}/${MY_P}"
254 +
255 +# patches merged upstream, to be removed with 16.2 or later bump
256 +PATCHES=(
257 + "${FILESDIR}"/pulseaudio-16.0-optional-module-console-kit.patch
258 + "${FILESDIR}"/pulseaudio-16.1-module-combine-sink-load-crash.patch
259 + "${FILESDIR}"/pulseaudio-16.1-module-combine-sink-unload-crash.patch
260 +)
261 +
262 +src_prepare() {
263 + default
264 +
265 + gnome2_environment_reset
266 +}
267 +
268 +src_configure() {
269 + local enable_bluez5_gstreamer="disabled"
270 + if use aptx || use ldac ; then
271 + enable_bluez5_gstreamer="enabled"
272 + fi
273 +
274 + local enable_fftw="disabled"
275 + if use equalizer || use fftw ; then
276 + enable_fftw="enabled"
277 + fi
278 +
279 + local emesonargs=(
280 + --localstatedir="${EPREFIX}"/var
281 +
282 + -Ddaemon=true
283 + -Dclient=false
284 + -Ddoxygen=false
285 + -Dgcov=false
286 + -Dman=true
287 + # tests involve random modules, so just do them for the native # TODO: tests should run always
288 + $(meson_use test tests)
289 + -Ddatabase=$(usex gdbm gdbm simple) # tdb is also an option but no one cares about it
290 + -Dstream-restore-clear-old-devices=true
291 + -Drunning-from-build-tree=false
292 +
293 + # Paths
294 + -Dmodlibexecdir="${EPREFIX}/usr/$(get_libdir)/pulseaudio/modules" # Was $(get_libdir)/${P}
295 + -Dsystemduserunitdir=$(systemd_get_userunitdir)
296 + -Dudevrulesdir="${EPREFIX}$(get_udevdir)/rules.d"
297 + -Dbashcompletiondir="$(get_bashcompdir)" # Alternatively DEPEND on app-shells/bash-completion for pkg-config to provide the value
298 +
299 + # Optional features
300 + $(meson_feature alsa)
301 + $(meson_feature asyncns)
302 + $(meson_feature zeroconf avahi)
303 + $(meson_feature bluetooth bluez5)
304 + -Dbluez5-gstreamer=${enable_bluez5_gstreamer}
305 + $(meson_use bluetooth bluez5-native-headset)
306 + $(meson_use ofono-headset bluez5-ofono-headset)
307 + -Dconsolekit=disabled
308 + $(meson_feature dbus)
309 + $(meson_feature elogind)
310 + -Dfftw=${enable_fftw}
311 + $(meson_feature glib) # WARNING: toggling this likely changes ABI
312 + $(meson_feature glib gsettings) # Supposedly correct?
313 + $(meson_feature gstreamer)
314 + -Dgtk=disabled
315 + -Dhal-compat=false
316 + -Dipv6=true
317 + $(meson_feature jack)
318 + $(meson_feature lirc)
319 + $(meson_feature ssl openssl)
320 + $(meson_feature orc)
321 + $(meson_feature oss oss-output)
322 + -Dsamplerate=disabled # Matches upstream
323 + $(meson_feature sox soxr)
324 + -Dspeex=enabled
325 + $(meson_feature systemd)
326 + $(meson_feature tcpd tcpwrap)
327 + $(meson_feature udev)
328 + $(meson_feature valgrind)
329 + $(meson_feature X x11)
330 +
331 + # Echo cancellation
332 + -Dadrian-aec=false # Not packaged?
333 + $(meson_feature webrtc-aec)
334 + )
335 +
336 + meson_src_configure
337 +}
338 +
339 +src_install() {
340 + meson_src_install
341 +
342 + # Upstream installs 'pactl' if client is built, with all symlinks except for
343 + # 'pulseaudio', 'pacmd' and 'pasuspender' which are installed if server is built.
344 + # This trips QA warning, workaround:
345 + # - install missing aliases in media-libs/libpulse (client build)
346 + # - remove corresponding symlinks in media-sound/pulseaudio-daemonclient (server build)
347 + rm "${D}/$(get_bashcompdir)"/pulseaudio || die
348 + rm "${D}/$(get_bashcompdir)"/pacmd || die
349 + rm "${D}/$(get_bashcompdir)"/pasuspender || die
350 +
351 + # Daemon configuration scripts will try to load snippets from corresponding '.d' dirs.
352 + # Install these dirs to silence a warning if they are missing.
353 + keepdir /etc/pulse/default.pa.d
354 + keepdir /etc/pulse/system.pa.d
355 +
356 + if use system-wide; then
357 + newconfd "${FILESDIR}"/pulseaudio.conf.d pulseaudio
358 +
359 + use_define() {
360 + local define=${2:-$(echo ${1} | tr '[:lower:]' '[:upper:]')}
361 +
362 + use "${1}" && echo "-D${define}" || echo "-U${define}"
363 + }
364 +
365 + unifdef -x 1 \
366 + $(use_define zeroconf AVAHI) \
367 + $(use_define alsa) \
368 + $(use_define bluetooth) \
369 + $(use_define udev) \
370 + "${FILESDIR}"/pulseaudio.init.d-5 \
371 + > "${T}"/pulseaudio \
372 + || die
373 +
374 + doinitd "${T}"/pulseaudio
375 +
376 + systemd_dounit "${FILESDIR}"/pulseaudio.service
377 +
378 + # We need /var/run/pulse, bug 442852
379 + newtmpfiles "${FILESDIR}"/pulseaudio.tmpfiles pulseaudio.conf
380 + else
381 + # Prevent warnings when system-wide is not used, bug 447694
382 + if use dbus; then
383 + rm "${ED}"/etc/dbus-1/system.d/pulseaudio-system.conf || die
384 + fi
385 + fi
386 +
387 + if use zeroconf; then
388 + sed -i \
389 + -e '/module-zeroconf-publish/s:^#::' \
390 + "${ED}/etc/pulse/default.pa" \
391 + || die
392 + fi
393 +
394 + # Only enable autospawning pulseaudio daemon on systems without systemd
395 + if ! use systemd; then
396 + insinto /etc/pulse/client.conf.d
397 + newins "${FILESDIR}/enable-autospawn.conf" "enable-autospawn.conf"
398 + fi
399 +
400 + find "${ED}" \( -name '*.a' -o -name '*.la' \) -delete || die
401 +}
402 +
403 +pkg_postinst() {
404 + gnome2_schemas_update
405 +
406 + use udev && udev_reload
407 +
408 + if use system-wide; then
409 + tmpfiles_process "pulseaudio.conf"
410 +
411 + elog "You have enabled the 'system-wide' USE flag for pulseaudio."
412 + elog "This mode should only be used on headless servers, embedded systems,"
413 + elog "or thin clients. It will usually require manual configuration, and is"
414 + elog "incompatible with many expected pulseaudio features."
415 + elog "On normal desktop systems, system-wide mode is STRONGLY DISCOURAGED."
416 + elog ""
417 + elog "For more information, see"
418 + elog " https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/"
419 + elog " https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SystemWide/"
420 + elog " https://wiki.gentoo.org/wiki/PulseAudio#Headless_server"
421 + elog ""
422 + fi
423 +
424 + if use equalizer; then
425 + elog "You will need to load some extra modules to make qpaeq work."
426 + elog "You can do that by adding the following two lines in"
427 + elog "/etc/pulse/default.pa and restarting pulseaudio:"
428 + elog "load-module module-equalizer-sink"
429 + elog "load-module module-dbus-protocol"
430 + elog ""
431 + fi
432 +
433 + if use bluetooth; then
434 + elog "You have enabled bluetooth USE flag for pulseaudio. Daemon will now handle"
435 + elog "bluetooth Headset (HSP HS and HSP AG) and Handsfree (HFP HF) profiles using"
436 + elog "native headset backend by default. This can be selectively disabled"
437 + elog "via runtime configuration arguments to module-bluetooth-discover"
438 + elog "in /etc/pulse/default.pa"
439 + elog "To disable HFP HF append enable_native_hfp_hf=false"
440 + elog "To disable HSP HS append enable_native_hsp_hs=false"
441 + elog "To disable HSP AG append headset=auto or headset=ofono"
442 + elog "(note this does NOT require enabling USE ofono)"
443 + elog ""
444 + fi
445 +
446 + if use ofono-headset; then
447 + elog "You have enabled both native and ofono headset profiles. The runtime decision"
448 + elog "which to use is done via the 'headset' argument of module-bluetooth-discover."
449 + elog ""
450 + fi
451 +
452 + if use gstreamer; then
453 + elog "GStreamer-based RTP implementation modile enabled."
454 + elog "To use OPUS payload install media-plugins/gst-plugins-opus"
455 + elog "and add enable_opus=1 argument to module-rtp-send"
456 + elog ""
457 + fi
458 +
459 + if use systemd; then
460 + elog "Pulseaudio autospawn by client library is no longer enabled when systemd is available."
461 + elog "It's recommended to start pulseaudio via its systemd user units:"
462 + elog ""
463 + elog " systemctl --user enable pulseaudio.service pulseaudio.socket"
464 + elog ""
465 + elog "Root user can change system default configuration for all users:"
466 + elog ""
467 + elog " systemctl --global enable pulseaudio.service pulseaudio.socket"
468 + elog ""
469 + elog "If you would like to enable autospawn by client library, edit autospawn flag in /etc/pulse/client.conf like this:"
470 + elog ""
471 + elog " autospawn = yes"
472 + elog ""
473 + elog "The change from autospawn to user units will take effect after restarting."
474 + elog ""
475 + fi
476 +
477 + optfeature_header "PulseAudio can be enhanced by installing the following:"
478 + use equalizer && optfeature "using the qpaeq script" dev-python/PyQt5[dbus,widgets]
479 + use dbus && optfeature "restricted realtime capabilities via D-Bus" sys-auth/rtkit
480 +}
481 +
482 +pkg_postrm() {
483 + gnome2_schemas_update
484 + use udev && udev_reload
485 +}