Subject: [PATCH v2] community/pipewire: kill previous instance before launch

From: Pranjal Kole <[email-masked]>
Date: Fri, 4 Mar 2022 20:14:48 +0530

/usr/bin/pipewire was not being killed previously.

The order in which the processes are killed has been
changed to avoid this error message from pipewire-media-session:

[W][77952.698669] ms.core      | [ media-session.c: 2211 core_error()] error id:0 seq:799 res:-32 (Broken pipe): connection error

Additionally, pipewire-pulse is now started with the /usr/bin/ prefix,
since a user may have another binary named pipewire in their $PATH.
---
 community/pipewire/APKBUILD             | 4 ++--
 community/pipewire/pipewire-launcher.sh | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/community/pipewire/APKBUILD b/community/pipewire/APKBUILD
index 561ab509d5..666a88efe9 100644
--- a/community/pipewire/APKBUILD
+++ b/community/pipewire/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer: Bart Ribbers <[email-masked]>
 pkgname=pipewire
 pkgver=0.3.48
-pkgrel=0
+pkgrel=1
 pkgdesc="Multimedia processing graphs"
 url="https://pipewire.org/"
 arch="all"
@@ -199,5 +199,5 @@ sha512sums="
 67699015612dfafd12f8e0908fa028a1ae91f8ce3a6cd7aeaf313ce991c6cfa206ace24a559bf64631c0a690ea8aa03f878c7f73e3c123881f1b015cf6627c50  pipewire-0.3.48.tar.gz
 3cd25a832cfb15ea60be2fdf2f4bb8d68984a6a57bf4a349afa3c497f86c3698edfc9811a5ba854ce9198219a81e6f1e40d6d9ee30ea4936323cbdace1fc1c0f  0001-Revert-pulse-tunnel-use-format-channels-and-rate-pro.patch
 d5d8bc64e42715aa94296e3e26e740142bff7f638c7eb4fecc0301e46d55636d889bdc0c0399c1eb523271b20f7c48cc03f6ce3c072e0e8576c821ed1ea0e3dd  pipewire.desktop
-61d616a19e15fbed41450c61a11cbdfe23def1d209e017539abdabf1c4d6511672db4e46de78522cb9979a0ab44b61f2e3773cac02258f2e273620c62eb65079  pipewire-launcher.sh
+be2bd1520fae27ccca6af4c98e8ebe63541260af55eb085839235a8441a7bce434ba8bf23a5d1ca8b5f361229f5482d5b63504b9a5cbbe9d39bc051207cd7dac  pipewire-launcher.sh
 "
diff --git a/community/pipewire/pipewire-launcher.sh b/community/pipewire/pipewire-launcher.sh
index 95dcd5efc2..ad3d950b6d 100644
--- a/community/pipewire/pipewire-launcher.sh
+++ b/community/pipewire/pipewire-launcher.sh
@@ -1,10 +1,10 @@
 #!/bin/sh
 
 # We need to kill any existing pipewire instance to restore sound
-pkill -u "${USER}" -x pipewire 1>/dev/null 2>&1
-pkill -u "${USER}" -fx "pipewire -c pipewire-pulse.conf" 1>/dev/null 2>&1
+pkill -u "${USER}" -fx "/usr/bin/pipewire -c pipewire-pulse.conf" 1>/dev/null 2>&1
 pkill -u "${USER}" -fx /usr/bin/pipewire-media-session 1>/dev/null 2>&1
 pkill -u "${USER}" -fx /usr/bin/wireplumber 1>/dev/null 2>&1
+pkill -u "${USER}" -fx /usr/bin/pipewire 1>/dev/null 2>&1
 
 exec /usr/bin/pipewire &
 
@@ -19,4 +19,4 @@ elif [ -x /usr/bin/pipewire-media-session ]; then
 	exec /usr/bin/pipewire-media-session &
 fi
 
-[ -f "/usr/share/pipewire/pipewire-pulse.conf" ] && exec pipewire -c pipewire-pulse.conf &
+[ -f "/usr/share/pipewire/pipewire-pulse.conf" ] && exec /usr/bin/pipewire -c pipewire-pulse.conf &
-- 
2.35.1