From 1be03a3ea3b08da0d980249b82a22b9f94ea7775 Mon Sep 17 00:00:00 2001 From: Aditya Alok Date: Wed, 8 Jan 2025 18:41:12 +0530 Subject: [PATCH] bump(main/pipewire): 1.2.7 - `src/pipewire/thread.c`: patch to support use of custom `create_function` added in https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/16f629d2245e88da317c094d1411ed83c1b41af9 Signed-off-by: Aditya Alok --- packages/pipewire/IPTOS_DSCP.patch | 14 +++---- packages/pipewire/build.sh | 4 +- packages/pipewire/pthread_cancel.patch | 57 ++++++++++++++------------ 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/packages/pipewire/IPTOS_DSCP.patch b/packages/pipewire/IPTOS_DSCP.patch index 21e901e2cab678..55b9ebb01a77c8 100644 --- a/packages/pipewire/IPTOS_DSCP.patch +++ b/packages/pipewire/IPTOS_DSCP.patch @@ -1,13 +1,13 @@ ---- a/src/modules/module-rtp-sink.c -+++ b/src/modules/module-rtp-sink.c -@@ -668,6 +668,10 @@ static int make_socket(struct sockaddr_s +--- pipewire-1.2.7/src/modules/module-rtp-sink.c 2024-11-26 14:37:54.000000000 +0530 ++++ pipewire-1.2.7.mod/src/modules/module-rtp-sink.c 2025-01-08 16:46:26.537354237 +0530 +@@ -258,6 +258,10 @@ pw_log_warn("setsockopt(SO_PRIORITY) failed: %m"); #endif if (dscp > 0) { -+#ifdef __ANDROID__ -+#define IPTOS_DSCP_MASK 0xfc -+#define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK) -+#endif ++ #ifdef __ANDROID__ ++ #define IPTOS_DSCP_MASK 0xfc ++ #define IPTOS_DSCP(x) ((x) & IPTOS_DSCP_MASK) ++ #endif val = IPTOS_DSCP(dscp << 2); if (setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof(val)) < 0) pw_log_warn("setsockopt(IP_TOS) failed: %m"); diff --git a/packages/pipewire/build.sh b/packages/pipewire/build.sh index 959a0bc6149e92..df5065d2402d2e 100644 --- a/packages/pipewire/build.sh +++ b/packages/pipewire/build.sh @@ -3,10 +3,10 @@ TERMUX_PKG_DESCRIPTION="A server and user space API to deal with multimedia pipe TERMUX_PKG_LICENSE="MIT, LGPL-2.1, LGPL-3.0, GPL-2.0" TERMUX_PKG_LICENSE_FILE="COPYING, LICENSE" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION="1.2.0" +TERMUX_PKG_VERSION="1.2.7" TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/${TERMUX_PKG_VERSION}/pipewire-${TERMUX_PKG_VERSION}.tar.bz2" -TERMUX_PKG_SHA256=a78516611257429633a1e020566cf03150a73d58c54e67bff936fd103d5bc6ce +TERMUX_PKG_SHA256=3c00292f9a419610c9eeb6e45b958d460afb601ecc6894012574a3b9f118616a TERMUX_PKG_AUTO_UPDATE=true TERMUX_PKG_DEPENDS="ffmpeg, glib, libc++, liblua54, libopus, libsndfile, libwebrtc-audio-processing, lilv, ncurses, openssl, pulseaudio, readline" diff --git a/packages/pipewire/pthread_cancel.patch b/packages/pipewire/pthread_cancel.patch index 34db89ae8a4fd7..062bca551ccc59 100644 --- a/packages/pipewire/pthread_cancel.patch +++ b/packages/pipewire/pthread_cancel.patch @@ -12,35 +12,35 @@ index 3cee8a2..e2ea8f5 100644 + pthread_kill(loop->thread, SIGUSR2); } else { pw_log_debug("%p signal", loop); - pw_loop_invoke(loop->loop, do_stop, 1, NULL, 0, false, loop); -diff --git a/src/pipewire/thread.c b/src/pipewire/thread.c -index cf656fb..ba5193f 100644 ---- a/src/pipewire/thread.c -+++ b/src/pipewire/thread.c -@@ -79,9 +79,44 @@ static int thread_setaffinity(pthread_t thread, const char *affinity) + pw_loop_invoke(loo + +--- pipewire-1.2.7/src/pipewire/thread.c 2024-11-26 14:37:54.000000000 +0530 ++++ pipewire-1.2.7.mod/src/pipewire/thread.c 2025-01-08 18:24:30.620004636 +0530 +@@ -80,11 +80,44 @@ + + static int thread_setaffinity(pthread_t thread, const char *affinity) { - cpu_set_t set; +- cpu_set_t set; ++ cpu_set_t set; parse_affinity(affinity, &set); +#ifdef __ANDROID__ + return -sched_setaffinity(pthread_gettid_np(thread), sizeof(set), &set); +#else return -pthread_setaffinity_np(thread, sizeof(set), &set); +#endif -+} -+ + } + +#ifdef __ANDROID__ +typedef struct wrapped_thread_start { + void *(*start)(void *); + void *arg; +} wrapped_thread_start_t; + -+static void thread_signal_handler(int signum) -+{ ++static void thread_signal_handler(int signum) { + pthread_exit(0); - } - -+static void *pthread_create_wrapper(void *wrapped_arg) -+{ ++} ++ ++static void *pthread_create_wrapper(void *wrapped_arg) { + wrapped_thread_start_t *wrapped_start = (wrapped_thread_start_t *)wrapped_arg; + + struct sigaction actions; @@ -62,19 +62,24 @@ index cf656fb..ba5193f 100644 static struct spa_thread *impl_create(void *object, const struct spa_dict *props, void *(*start)(void*), void *arg) -@@ -93,7 +128,16 @@ static struct spa_thread *impl_create(void *object, +@@ -102,7 +135,21 @@ + sscanf(str, "pointer:%p", &create_func) != 1) + create_func = pthread_create; - attr = pw_thread_fill_attr(props, &attributes); - -+#ifndef __ANDROID__ - err = pthread_create(&pt, attr, start, arg); ++#ifdef __ANDROID__ ++ if(create_func == pthread_create) { ++ wrapped_thread_start_t *wrapped_start = malloc(sizeof(wrapped_thread_start_t)); ++ if (wrapped_start == NULL) ++ return NULL; ++ wrapped_start->start = start; ++ wrapped_start->arg = arg; ++ err = pthread_create(&pt, attr, pthread_create_wrapper, wrapped_start); ++ } ++ else { ++ err = create_func(&pt, attr, start, arg); ++ } +#else -+ wrapped_thread_start_t *wrapped_start = malloc(sizeof(wrapped_thread_start_t)); -+ if (wrapped_start == NULL) -+ return NULL; -+ wrapped_start->start = start; -+ wrapped_start->arg = arg; -+ err = pthread_create(&pt, attr, pthread_create_wrapper, wrapped_start); + err = create_func(&pt, attr, start, arg); +#endif if (attr)