commit:     6773cae240f67b63545aad170a8ce49222379296
Author:     Niklāvs Koļesņikovs <89q1r14hd <AT> relay <DOT> firefox <DOT> com>
AuthorDate: Sun May 29 14:05:25 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May 30 04:42:28 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6773cae2

media-video/wireplumber: fix a bad mistake in 0.4.10-r2 by doing -r3

Somehow git format-patch ended up producing a revert for an unrelated
commit which either randomly or perhaps via some copy and paste error
happened to be a revert of the only patch that 0.4.10-r1 was applying.

Because of that wireplumber-0.4.10-r2 incorrectly dropped it. This is
now fixed in 0.4.10-r3 by reinstating the removed patch as well as
adding in the one that was meant to be present in -r2 but had been
incorrectly generated due to probably wrong git format-patch command.

Signed-off-by: Niklāvs Koļesņikovs <89q1r14hd <AT> relay.firefox.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...nodes-don-t-check-if-all-device-nodes-are.patch | 187 +++++++++++++++++++++
 .../wireplumber/wireplumber-0.4.10-r3.ebuild       | 126 ++++++++++++++
 2 files changed, 313 insertions(+)

diff --git 
a/media-video/wireplumber/files/wireplumber-0.4.10-m-default-nodes-don-t-check-if-all-device-nodes-are.patch
 
b/media-video/wireplumber/files/wireplumber-0.4.10-m-default-nodes-don-t-check-if-all-device-nodes-are.patch
new file mode 100644
index 000000000000..d9c51489a893
--- /dev/null
+++ 
b/media-video/wireplumber/files/wireplumber-0.4.10-m-default-nodes-don-t-check-if-all-device-nodes-are.patch
@@ -0,0 +1,187 @@
+https://gitlab.freedesktop.org/pipewire/wireplumber/-/commit/392cce2136e81ac3146078eacbbae85b694c917a
+
+From 392cce2136e81ac3146078eacbbae85b694c917a Mon Sep 17 00:00:00 2001
+From: Julian Bouzas <julian.bou...@collabora.com>
+Date: Fri, 20 May 2022 07:38:24 -0400
+Subject: [PATCH] m-default-nodes: don't check if all device nodes are ready
+ when finding default node
+
+This check was originally added to avoid a small audio glitch when changing
+default nodes while also changing the device profile (eg Gnome Sound Settings).
+The check is removed because it causes issues when disabling alsa nodes. There
+are plans to fix the audio glitch issue in the future with the planned
+event-dispatcher architecture.
+
+Fixes #279
+---
+ modules/module-default-nodes.c | 136 ---------------------------------
+ 1 file changed, 136 deletions(-)
+
+diff --git a/modules/module-default-nodes.c b/modules/module-default-nodes.c
+index 0fdaed5..577f9bb 100644
+--- a/modules/module-default-nodes.c
++++ b/modules/module-default-nodes.c
+@@ -345,135 +345,6 @@ reevaluate_default_node (WpDefaultNodes * self, 
WpMetadata *m, gint node_t)
+   }
+ }
+ 
+-static guint
+-get_device_total_nodes (WpPipewireObject * proxy)
+-{
+-  g_autoptr (WpIterator) profiles = NULL;
+-  g_auto (GValue) item = G_VALUE_INIT;
+-
+-  profiles = wp_pipewire_object_enum_params_sync (proxy, "Profile", NULL);
+-  if (!profiles)
+-    return 0;
+-
+-  for (; wp_iterator_next (profiles, &item); g_value_unset (&item)) {
+-    WpSpaPod *pod = g_value_get_boxed (&item);
+-    gint idx = -1;
+-    const gchar *name = NULL;
+-    g_autoptr (WpSpaPod) classes = NULL;
+-
+-    /* Parse */
+-    if (!wp_spa_pod_get_object (pod, NULL,
+-        "index", "i", &idx,
+-        "name", "s", &name,
+-        "classes", "?P", &classes,
+-        NULL))
+-      continue;
+-    if (!classes)
+-      continue;
+-
+-    /* Parse profile classes */
+-    {
+-      g_autoptr (WpIterator) it = wp_spa_pod_new_iterator (classes);
+-      g_auto (GValue) v = G_VALUE_INIT;
+-      gint total_nodes = 0;
+-      for (; wp_iterator_next (it, &v); g_value_unset (&v)) {
+-        WpSpaPod *entry = g_value_get_boxed (&v);
+-        g_autoptr (WpSpaPodParser) pp = NULL;
+-        const gchar *media_class = NULL;
+-        gint n_nodes = 0;
+-        g_return_val_if_fail (entry, 0);
+-        if (!wp_spa_pod_is_struct (entry))
+-          continue;
+-        pp = wp_spa_pod_parser_new_struct (entry);
+-        g_return_val_if_fail (pp, 0);
+-        g_return_val_if_fail (wp_spa_pod_parser_get_string (pp, 
&media_class), 0);
+-        g_return_val_if_fail (wp_spa_pod_parser_get_int (pp, &n_nodes), 0);
+-        wp_spa_pod_parser_end (pp);
+-
+-        total_nodes += n_nodes;
+-      }
+-
+-      if (total_nodes > 0)
+-        return total_nodes;
+-    }
+-  }
+-
+-  return 0;
+-}
+-
+-static gboolean
+-nodes_ready (WpDefaultNodes * self)
+-{
+-  g_autoptr (WpIterator) it = NULL;
+-  g_auto (GValue) val = G_VALUE_INIT;
+-
+-  /* Get the total number of nodes for each device and make sure they exist
+-   * and have at least 1 port */
+-  it = wp_object_manager_new_filtered_iterator (self->rescan_om,
+-      WP_TYPE_DEVICE, NULL);
+-  for (; wp_iterator_next (it, &val); g_value_unset (&val)) {
+-    WpPipewireObject *device = g_value_get_object (&val);
+-    guint total_nodes = get_device_total_nodes (device);
+-    if (total_nodes > 0) {
+-      guint32 device_id = wp_proxy_get_bound_id (WP_PROXY (device));
+-      g_autoptr (WpIterator) node_it = NULL;
+-      g_auto (GValue) node_val = G_VALUE_INIT;
+-      guint ready_nodes = 0;
+-
+-      node_it = wp_object_manager_new_filtered_iterator (self->rescan_om,
+-          WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY,
+-          PW_KEY_DEVICE_ID, "=i", device_id, NULL);
+-      for (; wp_iterator_next (node_it, &node_val); g_value_unset 
(&node_val)) {
+-        WpPipewireObject *node = g_value_get_object (&node_val);
+-        g_autoptr (WpPort) port =
+-              wp_object_manager_lookup (self->rescan_om,
+-              WP_TYPE_PORT, WP_CONSTRAINT_TYPE_PW_PROPERTY,
+-              PW_KEY_NODE_ID, "=u", wp_proxy_get_bound_id (WP_PROXY (node)),
+-              NULL);
+-        if (port)
+-          ready_nodes++;
+-      }
+-
+-      if (ready_nodes < total_nodes) {
+-        const gchar *device_name = wp_pipewire_object_get_property (
+-            WP_PIPEWIRE_OBJECT (device), PW_KEY_DEVICE_NAME);
+-        wp_debug_object (self, "device '%s' is not ready (%d/%d)", 
device_name,
+-            ready_nodes, total_nodes);
+-        return FALSE;
+-      }
+-    }
+-  }
+-
+-  /* Make sure Audio and Video virtual sources have ports */
+-  {
+-    g_autoptr (WpIterator) node_it = NULL;
+-    g_auto (GValue) node_val = G_VALUE_INIT;
+-    node_it = wp_object_manager_new_filtered_iterator (self->rescan_om,
+-        WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY, PW_KEY_DEVICE_ID, "-",
+-        NULL);
+-    for (; wp_iterator_next (node_it, &node_val); g_value_unset (&node_val)) {
+-      WpPipewireObject *node = g_value_get_object (&node_val);
+-      const gchar *media_class = wp_pipewire_object_get_property (
+-          WP_PIPEWIRE_OBJECT (node), PW_KEY_MEDIA_CLASS);
+-      g_autoptr (WpPort) port =
+-          wp_object_manager_lookup (self->rescan_om,
+-          WP_TYPE_PORT, WP_CONSTRAINT_TYPE_PW_PROPERTY,
+-          PW_KEY_NODE_ID, "=u", wp_proxy_get_bound_id (WP_PROXY (node)),
+-          NULL);
+-      if (!port &&
+-          (g_strcmp0 ("Audio/Source/Virtual", media_class) == 0 ||
+-           g_strcmp0 ("Video/Source/Virtual", media_class) == 0)) {
+-        const gchar *node_name = wp_pipewire_object_get_property (
+-            WP_PIPEWIRE_OBJECT (node), PW_KEY_NODE_NAME);
+-        wp_debug_object (self, "virtual node '%s' is not ready", node_name);
+-        return FALSE;
+-      }
+-    }
+-  }
+-
+-  return TRUE;
+-}
+-
+ static void
+ sync_rescan (WpCore * core, GAsyncResult * res, WpDefaultNodes * self)
+ {
+@@ -491,10 +362,6 @@ sync_rescan (WpCore * core, GAsyncResult * res, 
WpDefaultNodes * self)
+   if (!metadata)
+     return;
+ 
+-  /* Make sure nodes are ready for current profile */
+-  if (!nodes_ready (self))
+-    return;
+-
+   wp_trace_object (self, "re-evaluating defaults");
+   reevaluate_default_node (self, metadata, AUDIO_SINK);
+   reevaluate_default_node (self, metadata, AUDIO_SOURCE);
+@@ -584,13 +451,10 @@ on_metadata_added (WpObjectManager *om, WpMetadata 
*metadata, gpointer d)
+   self->rescan_om = wp_object_manager_new ();
+   wp_object_manager_add_interest (self->rescan_om, WP_TYPE_DEVICE, NULL);
+   wp_object_manager_add_interest (self->rescan_om, WP_TYPE_NODE, NULL);
+-  wp_object_manager_add_interest (self->rescan_om, WP_TYPE_PORT, NULL);
+   wp_object_manager_request_object_features (self->rescan_om, WP_TYPE_DEVICE,
+       WP_OBJECT_FEATURES_ALL);
+   wp_object_manager_request_object_features (self->rescan_om, WP_TYPE_NODE,
+       WP_OBJECT_FEATURES_ALL);
+-  wp_object_manager_request_object_features (self->rescan_om, WP_TYPE_PORT,
+-      WP_OBJECT_FEATURES_ALL);
+   g_signal_connect_object (self->rescan_om, "objects-changed",
+       G_CALLBACK (schedule_rescan), self, G_CONNECT_SWAPPED);
+   g_signal_connect_object (self->rescan_om, "object-added",
+-- 
+2.35.1
+

diff --git a/media-video/wireplumber/wireplumber-0.4.10-r3.ebuild 
b/media-video/wireplumber/wireplumber-0.4.10-r3.ebuild
new file mode 100644
index 000000000000..f5d48d6fca34
--- /dev/null
+++ b/media-video/wireplumber/wireplumber-0.4.10-r3.ebuild
@@ -0,0 +1,126 @@
+# 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 ~loong ~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
+       sys-devel/gettext
+"
+
+DEPEND="
+       ${LUA_DEPS}
+       >=dev-libs/glib-2.62
+       >=media-video/pipewire-0.3.48:=
+       virtual/libc
+       virtual/libintl
+       elogind? ( sys-auth/elogind )
+       systemd? ( sys-apps/systemd )
+"
+
+# Any dev-lua/* deps get declared like this inside RDEPEND:
+#      $(lua_gen_cond_dep '
+#              dev-lua/<NAME>[${LUA_USEDEP}]
+#      ')
+RDEPEND="${DEPEND}
+       system-service? (
+               acct-user/pipewire
+               acct-group/pipewire
+       )
+"
+
+DOCS=( {NEWS,README}.rst )
+
+PATCHES=(
+       
"${FILESDIR}"/${P}-config-fix-enabled-property-to-default-to-true-when.patch
+       
"${FILESDIR}"/${P}-m-lua-scripting-allow-converting-GValue-holding-NUL.patch
+       
"${FILESDIR}"/${P}-alsa.lua-fix-device-name-deduplication-when-reserva.patch
+       
"${FILESDIR}"/${P}-m-default-nodes-don-t-check-if-all-device-nodes-are.patch
+       "${FILESDIR}"/${P}-m-lua-scripting-fix-object-refcounting.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
+}

Reply via email to