Skip to content

Commit

Permalink
bump(main/pipewire): 1.2.7
Browse files Browse the repository at this point in the history
- `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 <[email protected]>
  • Loading branch information
MrAdityaAlok committed Jan 8, 2025
1 parent 3f58724 commit 1be03a3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 35 deletions.
14 changes: 7 additions & 7 deletions packages/pipewire/IPTOS_DSCP.patch
Original file line number Diff line number Diff line change
@@ -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");
4 changes: 2 additions & 2 deletions packages/pipewire/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
57 changes: 31 additions & 26 deletions packages/pipewire/pthread_cancel.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 1be03a3

Please sign in to comment.