From dbd15d4f2887fa9bd30a88ae68e77d23f0835928 Mon Sep 17 00:00:00 2001 From: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com> Date: Thu, 21 Apr 2022 21:02:38 +0300 Subject: media-video/wireplumber: backport two minor fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first fix deals with handling of device removal and is included for correctness sake, since it appears to be the right thing for WirePlumber to do. The second fix implements and documents D-Bus disabling for WirePlumber which must be done when attempting to run WirePlumber as a system service. This does not mean it's a recommended or even fully supported configuration but there's people who want it. And having it available should not cause any harm to other users. Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com> Signed-off-by: Sam James --- ...ment-which-options-need-to-be-turned-off-.patch | 87 +++++++++++++++ ...icy-device-profile-clear-tables-when-devi.patch | 33 ++++++ .../wireplumber/wireplumber-0.4.9-r1.ebuild | 121 +++++++++++++++++++++ 3 files changed, 241 insertions(+) create mode 100644 media-video/wireplumber/files/wireplumber-0.4.9-config-document-which-options-need-to-be-turned-off-.patch create mode 100644 media-video/wireplumber/files/wireplumber-0.4.9-scripts-policy-device-profile-clear-tables-when-devi.patch create mode 100644 media-video/wireplumber/wireplumber-0.4.9-r1.ebuild (limited to 'media-video/wireplumber') diff --git a/media-video/wireplumber/files/wireplumber-0.4.9-config-document-which-options-need-to-be-turned-off-.patch b/media-video/wireplumber/files/wireplumber-0.4.9-config-document-which-options-need-to-be-turned-off-.patch new file mode 100644 index 000000000000..9e664ec56564 --- /dev/null +++ b/media-video/wireplumber/files/wireplumber-0.4.9-config-document-which-options-need-to-be-turned-off-.patch @@ -0,0 +1,87 @@ +https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/0da29f38181e391160fa8702623050b8544ec775 + +From 0da29f38181e391160fa8702623050b8544ec775 Mon Sep 17 00:00:00 2001 +From: George Kiagiadakis +Date: Mon, 4 Apr 2022 14:38:28 +0300 +Subject: [PATCH] config: document which options need to be turned off to use + wp without D-Bus + +and actually implement an option for the logind module + +Related to: #237 +--- + src/config/bluetooth.lua.d/30-bluez-monitor.lua | 4 +++- + src/config/bluetooth.lua.d/50-bluez-config.lua | 8 ++++++++ + src/config/main.lua.d/50-alsa-config.lua | 4 +++- + src/config/main.lua.d/50-default-access-config.lua | 3 +++ + 4 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/src/config/bluetooth.lua.d/30-bluez-monitor.lua b/src/config/bluetooth.lua.d/30-bluez-monitor.lua +index 266d3e2f..ba86657f 100644 +--- a/src/config/bluetooth.lua.d/30-bluez-monitor.lua ++++ b/src/config/bluetooth.lua.d/30-bluez-monitor.lua +@@ -8,5 +8,7 @@ function bluez_monitor.enable() + rules = bluez_monitor.rules, + }) + +- load_optional_module("logind") ++ if bluez_monitor.properties["with-logind"] then ++ load_optional_module("logind") ++ end + end +diff --git a/src/config/bluetooth.lua.d/50-bluez-config.lua b/src/config/bluetooth.lua.d/50-bluez-config.lua +index 072504ec..dd8033ff 100644 +--- a/src/config/bluetooth.lua.d/50-bluez-config.lua ++++ b/src/config/bluetooth.lua.d/50-bluez-config.lua +@@ -34,6 +34,14 @@ bluez_monitor.properties = { + -- Register dummy AVRCP player, required for AVRCP volume function. + -- Disable if you are running mpris-proxy or equivalent. + --["bluez5.dummy-avrcp-player"] = true, ++ ++ -- Enable the logind module, which arbitrates which user will be allowed ++ -- to have bluetooth audio enabled at any given time (particularly useful ++ -- if you are using GDM as a display manager, as the gdm user also launches ++ -- pipewire and wireplumber). ++ -- This requires access to the D-Bus user session; disable if you are running ++ -- a system-wide instance of wireplumber. ++ ["with-logind"] = true, + } + + bluez_monitor.rules = { +diff --git a/src/config/main.lua.d/50-alsa-config.lua b/src/config/main.lua.d/50-alsa-config.lua +index 6c97e8ad..d29b0b6f 100644 +--- a/src/config/main.lua.d/50-alsa-config.lua ++++ b/src/config/main.lua.d/50-alsa-config.lua +@@ -7,6 +7,8 @@ alsa_monitor.properties = { + --["alsa.jack-device"] = false, + + -- Reserve devices via org.freedesktop.ReserveDevice1 on D-Bus ++ -- Disable if you are running a system-wide instance, which ++ -- doesn't have access to the D-Bus user session + ["alsa.reserve"] = true, + --["alsa.reserve.priority"] = -20, + --["alsa.reserve.application-name"] = "WirePlumber", +@@ -20,7 +22,7 @@ alsa_monitor.properties = { + + alsa_monitor.rules = { + -- An array of matches/actions to evaluate. +- -- ++ -- + -- If you want to disable some devices or nodes, you can apply properties per device as the following example. + -- The name can be found by running pw-cli ls Device, or pw-cli dump Device + --{ +diff --git a/src/config/main.lua.d/50-default-access-config.lua b/src/config/main.lua.d/50-default-access-config.lua +index 6cf18bed..45cc5b73 100644 +--- a/src/config/main.lua.d/50-default-access-config.lua ++++ b/src/config/main.lua.d/50-default-access-config.lua +@@ -1,4 +1,7 @@ + default_access.properties = { ++ -- Enable the use of the flatpak portal integration. ++ -- Disable if you are running a system-wide instance, which ++ -- doesn't have access to the D-Bus user session + ["enable-flatpak-portal"] = true, + } + +-- +GitLab + diff --git a/media-video/wireplumber/files/wireplumber-0.4.9-scripts-policy-device-profile-clear-tables-when-devi.patch b/media-video/wireplumber/files/wireplumber-0.4.9-scripts-policy-device-profile-clear-tables-when-devi.patch new file mode 100644 index 000000000000..4dc8e276fbfa --- /dev/null +++ b/media-video/wireplumber/files/wireplumber-0.4.9-scripts-policy-device-profile-clear-tables-when-devi.patch @@ -0,0 +1,33 @@ +https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/da5d25acbea5ae03336bd2b4ef2b0687b380978e + +From da5d25acbea5ae03336bd2b4ef2b0687b380978e Mon Sep 17 00:00:00 2001 +From: Pauli Virtanen +Date: Mon, 28 Mar 2022 20:16:52 +0300 +Subject: [PATCH] scripts: policy-device-profile: clear tables when devices + removed + +When device ids are invalidated, clear all local tables about them, +because the id may be reused by different object, or the same object +reappearing. +--- + src/scripts/policy-device-profile.lua | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/scripts/policy-device-profile.lua b/src/scripts/policy-device-profile.lua +index d0aa2696..9daeafaa 100644 +--- a/src/scripts/policy-device-profile.lua ++++ b/src/scripts/policy-device-profile.lua +@@ -229,4 +229,10 @@ self.om:connect("object-added", function (_, device) + handleProfiles (device, true) + end) + ++self.om:connect("object-removed", function (_, device) ++ local dev_id = device["bound-id"] ++ self.active_profiles[dev_id] = nil ++ self.best_profiles[dev_id] = nil ++end) ++ + self.om:activate() +-- +GitLab + diff --git a/media-video/wireplumber/wireplumber-0.4.9-r1.ebuild b/media-video/wireplumber/wireplumber-0.4.9-r1.ebuild new file mode 100644 index 000000000000..f269c7faf59c --- /dev/null +++ b/media-video/wireplumber/wireplumber-0.4.9-r1.ebuild @@ -0,0 +1,121 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LUA_COMPAT=( lua5-{3,4} ) + +inherit lua-single meson systemd + +if [[ ${PV} == 9999 ]]; then + EGIT_REPO_URI="https://gitlab.freedesktop.org/pipewire/${PN}.git" + EGIT_BRANCH="master" + inherit git-r3 +else + SRC_URI="https://gitlab.freedesktop.org/pipewire/${PN}/-/archive/${PV}/${P}.tar.gz" + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86" +fi + +DESCRIPTION="Replacement for pipewire-media-session" +HOMEPAGE="https://gitlab.freedesktop.org/pipewire/wireplumber" + +LICENSE="MIT" +SLOT="0/0.4" +IUSE="elogind system-service systemd test" + +REQUIRED_USE=" + ${LUA_REQUIRED_USE} + ?? ( elogind systemd ) + system-service? ( systemd ) +" + +RESTRICT="!test? ( test )" + +# introspection? ( dev-libs/gobject-introspection ) is valid but likely only used for doc building +BDEPEND=" + dev-libs/glib + dev-util/gdbus-codegen + dev-util/glib-utils +" + +DEPEND=" + ${LUA_DEPS} + >=dev-libs/glib-2.62 + >=media-video/pipewire-0.3.48:= + virtual/libc + elogind? ( sys-auth/elogind ) + systemd? ( sys-apps/systemd ) +" + +# Any dev-lua/* deps get declared like this inside RDEPEND: +# $(lua_gen_cond_dep ' +# dev-lua/[${LUA_USEDEP}] +# ') +RDEPEND="${DEPEND} + system-service? ( + acct-user/pipewire + acct-group/pipewire + ) +" + +DOCS=( {NEWS,README}.rst ) + +PATCHES=( + "${FILESDIR}"/${P}-scripts-policy-device-profile-clear-tables-when-devi.patch + "${FILESDIR}"/${P}-config-document-which-options-need-to-be-turned-off-.patch +) + +src_configure() { + local emesonargs=( + -Ddoc=disabled # Ebuild not wired up yet (Sphinx, Doxygen?) + -Dintrospection=disabled # Only used for Sphinx doc generation + -Dsystem-lua=true # We always unbundle everything we can + -Dsystem-lua-version=$(ver_cut 1-2 $(lua_get_version)) + $(meson_feature elogind) + $(meson_feature systemd) + $(meson_use system-service systemd-system-service) + $(meson_use systemd systemd-user-service) + -Dsystemd-system-unit-dir=$(systemd_get_systemunitdir) + -Dsystemd-user-unit-dir=$(systemd_get_userunitdir) + $(meson_use test tests) + ) + + meson_src_configure +} + +src_install() { + meson_src_install + + # We copy the default config, so that Gentoo tools can pick up on any + # updates and /etc does not end up with stale overrides. + # If a reflinking CoW filesystem is used (e.g. Btrfs), then the files + # will not actually get stored twice until modified. + insinto /etc + doins -r ${ED}/usr/share/wireplumber +} + +pkg_postinst() { + if systemd_is_booted ; then + ewarn "pipewire-media-session.service is no longer installed. You must switch" + ewarn "to wireplumber.service user unit before your next logout/reboot:" + ewarn "systemctl --user disable pipewire-media-session.service" + ewarn "systemctl --user --force enable wireplumber.service" + else + ewarn "Switch to WirePlumber will happen the next time gentoo-pipewire-launcher" + ewarn "is started (a replacement for directly calling pipewire binary)." + ewarn + ewarn "Please ensure that ${EROOT}/etc/pipewire/pipewire.conf either does not exist" + ewarn "or, if it does exist, that any reference to" + ewarn "${EROOT}/usr/bin/pipewire-media-session is commented out (begins with a #)." + fi + if use system-service; then + ewarn + ewarn "WARNING: you have enabled the system-service USE flag, which installs" + ewarn "the system-wide systemd units that enable WirePlumber to run as a system" + ewarn "service. This is more than likely NOT what you want. You are strongly" + ewarn "advised not to enable this mode and instead stick with systemd user" + ewarn "units. The default configuration files will likely not work out of" + ewarn "box, and you are on your own with configuration." + ewarn + fi +} -- cgit v1.2.3-65-gdbad