commit:     ab28982dfdacbbed1eb3c0327331767ff1854f40
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 30 12:03:03 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Sep 30 12:03:03 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ab28982d

media-video/pipewire: backport some more patches to 1.4.8

Sorry, I noticed Fedora has some others which I initially skipped.

Followup to 211924340dc1f91d4613841fa391d2c44e763dac.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/1.4.8/0006-revert-impl-node.patch        | 46 +++++++++++++++++++
 .../1.4.8/0007-impl-node-unprepare-once.patch      | 51 ++++++++++++++++++++++
 .../1.4.8/0008-control-fix-event-compare.patch     | 48 ++++++++++++++++++++
 ...re-1.4.8-r1.ebuild => pipewire-1.4.8-r2.ebuild} |  0
 4 files changed, 145 insertions(+)

diff --git a/media-video/pipewire/files/1.4.8/0006-revert-impl-node.patch 
b/media-video/pipewire/files/1.4.8/0006-revert-impl-node.patch
new file mode 100644
index 000000000000..6021bda3fb8e
--- /dev/null
+++ b/media-video/pipewire/files/1.4.8/0006-revert-impl-node.patch
@@ -0,0 +1,46 @@
+https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/3e574b314a7d73801fe3aac012cf6671bb1f5575
+
+From 3e574b314a7d73801fe3aac012cf6671bb1f5575 Mon Sep 17 00:00:00 2001
+From: Wim Taymans <[email protected]>
+Date: Mon, 15 Sep 2025 10:32:56 +0200
+Subject: [PATCH] Revert "impl-node: improve the node unprepare function"
+
+This reverts commit 839383d0dde8016f64c6b596917b971b4d1c37b0.
+---
+ src/pipewire/impl-node.c | 16 ++++++----------
+ 1 file changed, 6 insertions(+), 10 deletions(-)
+
+diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c
+index 89bb036861..e5636d5613 100644
+--- a/src/pipewire/impl-node.c
++++ b/src/pipewire/impl-node.c
+@@ -219,21 +219,17 @@ do_node_unprepare(struct spa_loop *loop, bool async, 
uint32_t seq,
+ {
+       struct pw_impl_node *this = user_data;
+       struct pw_node_target *t;
+-      int old_state, new_state;
++      int old_state;
+       uint64_t trigger = 0;
+ 
+       pw_log_trace("%p: unprepare %d remote:%d exported:%d", this, 
this->rt.prepared,
+                       this->remote, this->exported);
+ 
+-      /* The remote client will INACTIVE itself and remove itself from the 
loop to avoid
+-       * being scheduled.
+-       * The server will mark remote nodes as FINISHED. This will make sure 
the node will not
+-       * trigger the peers anymore when it will stop because we do that on 
the server side
+-       * because the client might simply be dead and not able to resume 
anything.
+-       */
+-      new_state = this->remote ? PW_NODE_ACTIVATION_FINISHED : 
PW_NODE_ACTIVATION_INACTIVE;
+-
+-      old_state = SPA_ATOMIC_XCHG(this->rt.target.activation->status, 
new_state);
++      /* We mark ourself as finished now, this will avoid going further into 
the process loop
++       * in case our fd was ready (removing ourselfs from the loop should 
avoid that as well).
++       * If we were supposed to be scheduled make sure we continue the graph 
for the peers we
++       * were supposed to trigger */
++      old_state = SPA_ATOMIC_XCHG(this->rt.target.activation->status, 
PW_NODE_ACTIVATION_INACTIVE);
+       if (PW_NODE_ACTIVATION_PENDING_TRIGGER(old_state))
+               trigger = get_time_ns(this->rt.target.system);
+ 
+-- 
+GitLab

diff --git 
a/media-video/pipewire/files/1.4.8/0007-impl-node-unprepare-once.patch 
b/media-video/pipewire/files/1.4.8/0007-impl-node-unprepare-once.patch
new file mode 100644
index 000000000000..10a14a0f83dd
--- /dev/null
+++ b/media-video/pipewire/files/1.4.8/0007-impl-node-unprepare-once.patch
@@ -0,0 +1,51 @@
+https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/24ab601201223e05950bb8133be5d77526de1997
+
+From 24ab601201223e05950bb8133be5d77526de1997 Mon Sep 17 00:00:00 2001
+From: Wim Taymans <[email protected]>
+Date: Mon, 15 Sep 2025 10:22:16 +0200
+Subject: [PATCH] impl-node: only do unprepare once
+
+There is not reason to do the unprepare logic twice and it might
+actually interfere with the actions of the client.
+
+See #4840
+Fixes #4893
+---
+ src/pipewire/impl-node.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c
+index e5636d5613..59a34475c1 100644
+--- a/src/pipewire/impl-node.c
++++ b/src/pipewire/impl-node.c
+@@ -225,17 +225,21 @@ do_node_unprepare(struct spa_loop *loop, bool async, 
uint32_t seq,
+       pw_log_trace("%p: unprepare %d remote:%d exported:%d", this, 
this->rt.prepared,
+                       this->remote, this->exported);
+ 
+-      /* We mark ourself as finished now, this will avoid going further into 
the process loop
+-       * in case our fd was ready (removing ourselfs from the loop should 
avoid that as well).
+-       * If we were supposed to be scheduled make sure we continue the graph 
for the peers we
+-       * were supposed to trigger */
++      if (!this->rt.prepared)
++              return 0;
++
++      /* The remote client will INACTIVE itself and remove itself from the 
loop to avoid
++       * being scheduled.
++       * The server will mark remote nodes as FINISHED and trigger the peers. 
This will
++       * make sure the remote node will not trigger the peers anymore when it 
will
++       * stop (it only triggers peers when it has PENDING_TRIGGER (<= 
AWAKE)). We have
++       * to trigger the peers on the server because the client might simply 
be dead and
++       * not able to trigger anything.
++       */
+       old_state = SPA_ATOMIC_XCHG(this->rt.target.activation->status, 
PW_NODE_ACTIVATION_INACTIVE);
+       if (PW_NODE_ACTIVATION_PENDING_TRIGGER(old_state))
+               trigger = get_time_ns(this->rt.target.system);
+ 
+-      if (!this->rt.prepared)
+-              return 0;
+-
+       if (!this->remote)
+               spa_loop_remove_source(loop, &this->source);
+ 
+-- 
+GitLab

diff --git 
a/media-video/pipewire/files/1.4.8/0008-control-fix-event-compare.patch 
b/media-video/pipewire/files/1.4.8/0008-control-fix-event-compare.patch
new file mode 100644
index 000000000000..88455e959a82
--- /dev/null
+++ b/media-video/pipewire/files/1.4.8/0008-control-fix-event-compare.patch
@@ -0,0 +1,48 @@
+https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/5212649ee1b9e494ff2a3eb16922a3ef5c6987a5
+
+From 5212649ee1b9e494ff2a3eb16922a3ef5c6987a5 Mon Sep 17 00:00:00 2001
+From: Wim Taymans <[email protected]>
+Date: Tue, 16 Sep 2025 10:47:12 +0200
+Subject: [PATCH] control: fix event compare function
+
+We can only compare UMP when both types are 2 or 4, so it must be
+different from 2 *and* 4 to be rejected.
+
+Fixes #4899
+---
+ pipewire-jack/src/pipewire-jack.c | 4 ++--
+ spa/plugins/control/mixer.c       | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/pipewire-jack/src/pipewire-jack.c 
b/pipewire-jack/src/pipewire-jack.c
+index 2b9d21948a..1867aebae0 100644
+--- a/pipewire-jack/src/pipewire-jack.c
++++ b/pipewire-jack/src/pipewire-jack.c
+@@ -1513,8 +1513,8 @@ static inline int event_sort(struct spa_pod_control *a, 
struct spa_pod_control *
+               uint32_t *sa = SPA_POD_BODY(&a->value), *sb = 
SPA_POD_BODY(&b->value);
+               if (SPA_POD_BODY_SIZE(&a->value) < 4 || 
SPA_POD_BODY_SIZE(&b->value) < 4)
+                       return 0;
+-              if ((sa[0] >> 28) != 2 || (sa[0] >> 28) != 4 ||
+-                  (sb[0] >> 28) != 2 || (sb[0] >> 28) != 4)
++              if (((sa[0] >> 28) != 2 && (sa[0] >> 28) != 4) ||
++                  ((sb[0] >> 28) != 2 && (sb[0] >> 28) != 4))
+                       return 0;
+               return event_compare(sa[0] >> 16, sb[0] >> 16);
+       }
+diff --git a/spa/plugins/control/mixer.c b/spa/plugins/control/mixer.c
+index cfe3c394b2..feb622435a 100644
+--- a/spa/plugins/control/mixer.c
++++ b/spa/plugins/control/mixer.c
+@@ -662,8 +662,8 @@ static inline int event_sort(struct spa_pod_control *a, 
struct spa_pod_control *
+               uint32_t *da = SPA_POD_BODY(&a->value), *db = 
SPA_POD_BODY(&b->value);
+               if (SPA_POD_BODY_SIZE(&a->value) < 4 || 
SPA_POD_BODY_SIZE(&b->value) < 4)
+                       return 0;
+-              if ((da[0] >> 28) != 2 || (da[0] >> 28) != 4 ||
+-                  (db[0] >> 28) != 2 || (db[0] >> 28) != 4)
++              if (((da[0] >> 28) != 2 && (da[0] >> 28) != 4) ||
++                  ((db[0] >> 28) != 2 && (db[0] >> 28) != 4))
+                       return 0;
+               return event_compare(da[0] >> 16, db[0] >> 16);
+       }
+-- 
+GitLab

diff --git a/media-video/pipewire/pipewire-1.4.8-r1.ebuild 
b/media-video/pipewire/pipewire-1.4.8-r2.ebuild
similarity index 100%
rename from media-video/pipewire/pipewire-1.4.8-r1.ebuild
rename to media-video/pipewire/pipewire-1.4.8-r2.ebuild

Reply via email to