From c0ca5f1a37a8e779337503d90e7ed2f0257d61f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sun, 19 Feb 2023 01:09:43 +0000 Subject: [PATCH] ao_pipewire: use realtime scheduling for data thread By making the data thread realtime it is able to serve requests faster and more reliable reducing crackling in certain situations. As the mpv callbacks that are running on the data thread are all non-blocking and very short this should be safe. The same mechanism is also used by pw-cat and the alsa plugin shipped by pipewire. --- audio/out/ao_pipewire.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c index 5e83a635ea..c2d785b841 100644 --- a/audio/out/ao_pipewire.c +++ b/audio/out/ao_pipewire.c @@ -487,7 +487,10 @@ static int pipewire_init_boilerplate(struct ao *ao) if (pw_thread_loop_start(p->loop) < 0) goto error; - context = pw_context_new(pw_thread_loop_get_loop(p->loop), NULL, 0); + context = pw_context_new( + pw_thread_loop_get_loop(p->loop), + pw_properties_new(PW_KEY_CONFIG_NAME, "client-rt.conf", NULL), + 0); if (!context) goto error;