diff options
author | Sam James <sam@gentoo.org> | 2023-07-23 18:39:52 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-07-23 18:39:52 +0100 |
commit | e29598d80e5b6f0e45eccdcab2f920304f2ed0b7 (patch) | |
tree | 95969f2291be53e63673e70a13dd56a9387dff6f /media-video | |
parent | dev-python/pikepdf: add 8.2.1 (diff) | |
download | gentoo-e29598d80e5b6f0e45eccdcab2f920304f2ed0b7.tar.gz gentoo-e29598d80e5b6f0e45eccdcab2f920304f2ed0b7.tar.bz2 gentoo-e29598d80e5b6f0e45eccdcab2f920304f2ed0b7.zip |
media-video/pipewire: backport two fixes to 0.3.75
1. Crash fix for when can't connect to dbus (bug #910714)
2. Help out software misusing API, like older mpv (new fixed mpv will be in tree
shortly anyway) (https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3374)
Closes: https://bugs.gentoo.org/910714
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-video')
-rw-r--r-- | media-video/pipewire/files/0.3.75/0001-module-rt-error-out-on-load-no-bus.patch | 83 | ||||
-rw-r--r-- | media-video/pipewire/files/0.3.75/0002-thread-loop-only-signal-when-option-set.patch | 68 | ||||
-rw-r--r-- | media-video/pipewire/pipewire-0.3.75-r1.ebuild (renamed from media-video/pipewire/pipewire-0.3.75.ebuild) | 0 |
3 files changed, 151 insertions, 0 deletions
diff --git a/media-video/pipewire/files/0.3.75/0001-module-rt-error-out-on-load-no-bus.patch b/media-video/pipewire/files/0.3.75/0001-module-rt-error-out-on-load-no-bus.patch new file mode 100644 index 000000000000..8885eb8a564f --- /dev/null +++ b/media-video/pipewire/files/0.3.75/0001-module-rt-error-out-on-load-no-bus.patch @@ -0,0 +1,83 @@ +https://bugs.gentoo.org/910714 +https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/55812195ce3b77317e7a2dc642b78271f3a45c8e + +From 55812195ce3b77317e7a2dc642b78271f3a45c8e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= <joanbrugueram@gmail.com> +Date: Sat, 22 Jul 2023 01:20:58 +0000 +Subject: [PATCH] module-rt: error out on load if no bus is available + +Since the recent changes to the RT module in Pipewire 0.3.75, some +applications such as those using OpenAL-Soft crash on startup if +neither the session nor the system bus is available. For example: + + bwrap --dev-bind / / \ + --bind /dev/null /run/dbus/system_bus_socket \ + --bind /dev/null $XDG_RUNTIME_DIR/bus \ + openal-info + +Will result in a crash with the following error message: + + dbus[1626147]: arguments to dbus_message_new_method_call() were + incorrect, assertion "path != NULL" failed in file dbus-message.c + line 1373. + This is normally a bug in some application using the D-Bus library. + +The RT module previously failed to load if no bus was available, but +after the recent changes, the init. logic runs in a thread, and failing +to obtain the bus no longer causes the module to fail to load. + +Then, functions called later such as `pw_rtkit_make_realtime` assume +the bus is available and try to use it, causing the error above. + +Put the logic for obtaining and checking the bus back to `module_init`, +so the module fails to load again if no bus is available. +--- a/src/modules/module-rt.c ++++ b/src/modules/module-rt.c +@@ -923,14 +923,11 @@ static int check_rtkit(struct impl *impl, struct pw_context *context, bool *can_ + return 0; + } + +-static int do_rtkit_setup(struct spa_loop *loop, bool async, uint32_t seq, +- const void *data, size_t size, void *user_data) ++static int rtkit_get_bus(struct impl *impl) + { +- struct impl *impl = user_data; + int res; +- long long retval; + +- pw_log_debug("enter rtkit setup"); ++ pw_log_debug("enter rtkit get bus"); + + /* Checking xdg-desktop-portal. It works fine in all situations. */ + if (impl->rtportal_enabled) +@@ -967,6 +964,18 @@ static int do_rtkit_setup(struct spa_loop *loop, bool async, uint32_t seq, + return res; + } + } ++ ++ return 0; ++} ++ ++static int do_rtkit_setup(struct spa_loop *loop, bool async, uint32_t seq, ++ const void *data, size_t size, void *user_data) ++{ ++ struct impl *impl = user_data; ++ long long retval; ++ ++ pw_log_debug("enter rtkit setup"); ++ + /* get some properties */ + if (rtkit_get_int_property(impl, "MaxRealtimePriority", &retval) < 0) { + retval = 1; +@@ -1076,6 +1085,9 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) + #ifdef HAVE_DBUS + impl->use_rtkit = use_rtkit; + if (impl->use_rtkit) { ++ if ((res = rtkit_get_bus(impl)) < 0) ++ goto error; ++ + impl->thread_loop = pw_thread_loop_new("module-rt", NULL); + if (impl->thread_loop == NULL) { + res = -errno; +-- +GitLab diff --git a/media-video/pipewire/files/0.3.75/0002-thread-loop-only-signal-when-option-set.patch b/media-video/pipewire/files/0.3.75/0002-thread-loop-only-signal-when-option-set.patch new file mode 100644 index 000000000000..670847b2f86a --- /dev/null +++ b/media-video/pipewire/files/0.3.75/0002-thread-loop-only-signal-when-option-set.patch @@ -0,0 +1,68 @@ +https://github.com/mpv-player/mpv/issues/11995 +https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3374 +https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/920bb7160e0be0ce5729d9538f6dea966f297603 + +From 920bb7160e0be0ce5729d9538f6dea966f297603 Mon Sep 17 00:00:00 2001 +From: Wim Taymans <wtaymans@redhat.com> +Date: Sun, 23 Jul 2023 18:16:00 +0200 +Subject: [PATCH] thread-loop: only signal when option is set + +Add a thead-loop.start-signal option that will do a signal before +entering the thread loop. Doing the signal in all cases can confuse +apps that don't expect the signal. + +Make module-rt use the thread-loop.start-signal. + +Fixes #3374 +--- a/src/modules/module-rt.c ++++ b/src/modules/module-rt.c +@@ -1085,10 +1085,14 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) + #ifdef HAVE_DBUS + impl->use_rtkit = use_rtkit; + if (impl->use_rtkit) { ++ struct spa_dict_item items[] = { ++ { "thread-loop.start-signal", "true" } ++ }; + if ((res = rtkit_get_bus(impl)) < 0) + goto error; + +- impl->thread_loop = pw_thread_loop_new("module-rt", NULL); ++ impl->thread_loop = pw_thread_loop_new("module-rt", ++ &SPA_DICT_INIT_ARRAY(items)); + if (impl->thread_loop == NULL) { + res = -errno; + goto error; +--- a/src/pipewire/thread-loop.c ++++ b/src/pipewire/thread-loop.c +@@ -43,6 +43,7 @@ struct pw_thread_loop { + int n_waiting_for_accept; + unsigned int created:1; + unsigned int running:1; ++ unsigned int start_signal:1; + }; + /** \endcond */ + +@@ -143,6 +144,11 @@ static struct pw_thread_loop *loop_new(struct pw_loop *loop, + return NULL; + + pw_log_debug("%p: new name:%s", this, name); ++ if (props != NULL) { ++ const char *str = spa_dict_lookup(props, "thread-loop.start-signal"); ++ if (str != NULL) ++ this->start_signal = spa_atob(str); ++ } + + if (loop == NULL) { + loop = pw_loop_new(props); +@@ -282,7 +288,8 @@ static void *do_loop(void *user_data) + pw_log_debug("%p: enter thread", this); + pw_loop_enter(this->loop); + +- pw_thread_loop_signal(this, false); ++ if (this->start_signal) ++ pw_thread_loop_signal(this, false); + + while (this->running) { + if ((res = pw_loop_iterate(this->loop, -1)) < 0) { +-- +GitLab diff --git a/media-video/pipewire/pipewire-0.3.75.ebuild b/media-video/pipewire/pipewire-0.3.75-r1.ebuild index dfb5716fd7bf..dfb5716fd7bf 100644 --- a/media-video/pipewire/pipewire-0.3.75.ebuild +++ b/media-video/pipewire/pipewire-0.3.75-r1.ebuild |