Date: Thursday, August 11, 2022 @ 12:18:29 Author: heftig Revision: 452556
archrelease: copy trunk to testing-x86_64 Added: wireplumber/repos/testing-x86_64/ wireplumber/repos/testing-x86_64/398.patch (from rev 452555, wireplumber/trunk/398.patch) wireplumber/repos/testing-x86_64/PKGBUILD (from rev 452555, wireplumber/trunk/PKGBUILD) wireplumber/repos/testing-x86_64/wireplumber.install (from rev 452555, wireplumber/trunk/wireplumber.install) ---------------------+ 398.patch | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++ PKGBUILD | 89 +++++++++++++++++++++++++++ wireplumber.install | 23 +++++++ 3 files changed, 273 insertions(+) Copied: wireplumber/repos/testing-x86_64/398.patch (from rev 452555, wireplumber/trunk/398.patch) =================================================================== --- testing-x86_64/398.patch (rev 0) +++ testing-x86_64/398.patch 2022-08-11 12:18:29 UTC (rev 452556) @@ -0,0 +1,161 @@ +From ba10c7d8c68db7b79cfa9f0e42432b63a76c415a Mon Sep 17 00:00:00 2001 +From: Pauli Virtanen <p...@iki.fi> +Date: Tue, 19 Jul 2022 20:39:06 +0300 +Subject: [PATCH 1/2] policy-node: fix potential rescan loop + +SiLink activation might be delayed indefinitely under some error +conditions. Currently, policy-node schedules a rescan when it sees a +non-activated link on a stream to be moved, which produces busy loop if +the si-link doesn't activate. + +Instead of rescheduling on non-active si-links, just remove and emit a +warning. The si-link then gets removed once it gets activated. + +Reproducer: + +1. Play audio from Rhythmbox and pause. +2. Switch default output with pactl between two different outputs +3. Links from the paused stream stay at "init" +--- + src/scripts/policy-node.lua | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +diff --git a/src/scripts/policy-node.lua b/src/scripts/policy-node.lua +index e6816723..43df701c 100644 +--- a/src/scripts/policy-node.lua ++++ b/src/scripts/policy-node.lua +@@ -694,16 +694,15 @@ function handleLinkable (si) + local link = lookupLink (si_id, si_flags[si_id].peer_id) + if reconnect then + if link ~= nil then +- -- remove old link if active, otherwise schedule rescan +- if ((link:get_active_features() & Feature.SessionItem.ACTIVE) ~= 0) then +- si_flags[si_id].peer_id = nil +- link:remove () +- Log.info (si, "... moving to new target") +- else +- scheduleRescan() +- Log.info (si, "... scheduled rescan") +- return ++ -- remove old link ++ if ((link:get_active_features() & Feature.SessionItem.ACTIVE) == 0) then ++ -- remove also not yet activated links: they might never become active, ++ -- and we should not loop waiting for them ++ Log.warning (link, "Link was not activated before removing") + end ++ si_flags[si_id].peer_id = nil ++ link:remove () ++ Log.info (si, "... moving to new target") + end + else + if link ~= nil then +-- +GitLab + + +From dd017b43fa1077200ae5e00f697334908ef1b9b2 Mon Sep 17 00:00:00 2001 +From: Pauli Virtanen <p...@iki.fi> +Date: Tue, 19 Jul 2022 20:01:10 +0300 +Subject: [PATCH 2/2] m-si-link: don't wait for establish before activation + + cleanup links + +SiLink should not wait for WpLinks becoming ESTABLISHED, before +activation. That flag shows whether a link has moved away from the +"init" state, however, links to e.g. Pulseaudio corked streams can stay +in "init" state until uncorking. This causes trouble for policies, +which needlessly wait for such links to establish. + +The WpLink objects may also be kept alive by other referents, and +just unrefing them does not necessarily destroy the PW objects. + +Activate SiLink even if the WpLink is still in "init" state. It's enough +that the link otherwise successfully establishes. + +At dispose time, explicitly request destroying the WpLinks that were +created by the SiLink, to ensure they are removed even if there's +something else referring to them. +--- + modules/module-si-standard-link.c | 32 ++++++++++++++++++++++++++----- + 1 file changed, 27 insertions(+), 5 deletions(-) + +diff --git a/modules/module-si-standard-link.c b/modules/module-si-standard-link.c +index dbebf391..9af71342 100644 +--- a/modules/module-si-standard-link.c ++++ b/modules/module-si-standard-link.c +@@ -132,6 +132,27 @@ si_standard_link_get_associated_proxy (WpSessionItem * item, GType proxy_type) + return NULL; + } + ++static void ++request_destroy_link (gpointer data, gpointer user_data) ++{ ++ WpLink *link = WP_LINK (data); ++ ++ wp_global_proxy_request_destroy (WP_GLOBAL_PROXY (link)); ++} ++ ++static void ++clear_node_links (GPtrArray **node_links_p) ++{ ++ /* ++ * Something else (eg. object managers) may be keeping the WpLink ++ * objects alive. Deactive the links now, to destroy the PW objects. ++ */ ++ if (*node_links_p) ++ g_ptr_array_foreach (*node_links_p, request_destroy_link, NULL); ++ ++ g_clear_pointer (node_links_p, g_ptr_array_unref); ++} ++ + static void + si_standard_link_disable_active (WpSessionItem *si) + { +@@ -154,7 +175,8 @@ si_standard_link_disable_active (WpSessionItem *si) + WP_SI_LINKABLE (si_in)); + } + +- g_clear_pointer (&self->node_links, g_ptr_array_unref); ++ clear_node_links (&self->node_links); ++ + self->n_active_links = 0; + self->n_failed_links = 0; + self->n_async_ops_wait = 0; +@@ -168,7 +190,7 @@ on_link_activated (WpObject * proxy, GAsyncResult * res, + WpTransition * transition) + { + WpSiStandardLink *self = wp_transition_get_source_object (transition); +- guint len = self->node_links->len; ++ guint len = self->node_links ? self->node_links->len : 0; + + /* Count the number of failed and active links */ + if (wp_object_activate_finish (proxy, res, NULL)) +@@ -182,7 +204,7 @@ on_link_activated (WpObject * proxy, GAsyncResult * res, + + /* We only active feature if all links activated successfully */ + if (self->n_failed_links > 0) { +- g_clear_pointer (&self->node_links, g_ptr_array_unref); ++ clear_node_links (&self->node_links); + wp_transition_return_error (transition, g_error_new ( + WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_OPERATION_FAILED, + "%d of %d PipeWire links failed to activate", +@@ -251,7 +273,7 @@ create_links (WpSiStandardLink * self, WpTransition * transition, + /* Clear old links if any */ + self->n_active_links = 0; + self->n_failed_links = 0; +- g_clear_pointer (&self->node_links, g_ptr_array_unref); ++ clear_node_links (&self->node_links); + + /* tuple format: + uint32 node_id; +@@ -327,7 +349,7 @@ create_links (WpSiStandardLink * self, WpTransition * transition, + + /* activate to ensure it is created without errors */ + wp_object_activate_closure (WP_OBJECT (link), +- WP_OBJECT_FEATURES_ALL, NULL, ++ WP_OBJECT_FEATURES_ALL & ~WP_LINK_FEATURE_ESTABLISHED, NULL, + g_cclosure_new_object ( + (GCallback) on_link_activated, G_OBJECT (transition))); + } +-- +GitLab + Copied: wireplumber/repos/testing-x86_64/PKGBUILD (from rev 452555, wireplumber/trunk/PKGBUILD) =================================================================== --- testing-x86_64/PKGBUILD (rev 0) +++ testing-x86_64/PKGBUILD 2022-08-11 12:18:29 UTC (rev 452556) @@ -0,0 +1,89 @@ +# Maintainer: David Runge <dv...@archlinux.org> +# Maintainer: Jan Alexander Steffens (heftig) <hef...@archlinux.org> + +pkgbase=wireplumber +pkgname=(wireplumber wireplumber-docs) +_commit=80b3559963f0ad40a7bfa6c23b0098275c0b5ebe # tags/0.4.11 +pkgver=0.4.11 +pkgrel=4 +pkgdesc="Session / policy manager implementation for PipeWire" +url="https://pipewire.pages.freedesktop.org/wireplumber/" +arch=(x86_64) +license=(MIT) +makedepends=(git meson doxygen graphviz 'pipewire>=0.3.52' systemd glib2 lua + gobject-introspection python-sphinx python-sphinx_rtd_theme + python-breathe python-lxml) +options=(debug) +source=("git+https://gitlab.freedesktop.org/pipewire/$pkgbase.git#commit=$_commit" + 398.patch) +sha256sums=('SKIP' + 'c51e1dfed7456186fc9f8630a116c593978b2b5d62b895236c595a54ea735827') + +pkgver() { + cd $pkgbase + git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + cd $pkgbase + + # Fix sound inside VM + git cherry-pick -n c16e637c329bc9dda8544b18f5bd47a8d63ee253 + + # https://bugs.archlinux.org/task/75352 + git cherry-pick -n eb406bdb2cbbcd49c55c71285f8f2eddb624d24b + + # https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/152 + # https://gitlab.freedesktop.org/pipewire/wireplumber/-/merge_requests/398 + git apply -3 ../398.patch +} + +build() { + local meson_options=( + -D system-lua=true + -D elogind=disabled + ) + + arch-meson $pkgbase build "${meson_options[@]}" + meson compile -C build +} + +check() { + meson test -C build --print-errorlogs +} + +_pick() { + local p="$1" f d; shift + for f; do + d="$srcdir/$p/${f#$pkgdir/}" + mkdir -p "$(dirname "$d")" + mv "$f" "$d" + rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")" + done +} + +package_wireplumber() { + depends=('pipewire>=0.3.52' lua libpipewire-0.3.so libsystemd.so + libg{lib,module,object,io}-2.0.so) + optdepends=('wireplumber-docs: Documentation') + provides=(pipewire-session-manager libwireplumber-0.4.so) + conflicts=(pipewire-media-session) + install=wireplumber.install + + meson install -C build --destdir "$pkgdir" + + _pick docs "$pkgdir"/usr/share/doc + + install -Dt "$pkgdir/usr/share/doc/$pkgname" -m644 $pkgbase/{NEWS,README}* + install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 $pkgbase/LICENSE +} + +package_wireplumber-docs() { + pkgdesc+=" - documentation" + + mv docs/* "$pkgdir" + + install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 $pkgbase/LICENSE +} + +# vim:set sw=2 et: Copied: wireplumber/repos/testing-x86_64/wireplumber.install (from rev 452555, wireplumber/trunk/wireplumber.install) =================================================================== --- testing-x86_64/wireplumber.install (rev 0) +++ testing-x86_64/wireplumber.install 2022-08-11 12:18:29 UTC (rev 452556) @@ -0,0 +1,23 @@ +post_install() { + # Enable service by default, creating an alias from + # pipewire-session-manager.service, which is required by pipewire.service + systemctl --global enable wireplumber.service +} + +post_upgrade() { + # Reenable the service if needed so the alias gets created. + if (( $(vercmp "$2" '0.4.4-2') < 0)); then + # Unlike pipewire-media-session, we introduce the enable of wireplumber + # in the same release as the alias, thus can unconditionally reenable. + systemctl --global reenable wireplumber.service + cat <<MSG +>>> If you enabled wireplumber.service manually for any user, run + "systemctl --user reenable wireplumber.service" for these users + now. This will create a required service alias. +MSG + fi +} + +pre_remove() { + systemctl --global disable wireplumber.service +}