[pulseaudio-discuss] [PATCH] null-sink, null-source: Use realtime scheduling if possible

Arun Raghavan arun at arunraghavan.net
Sun May 6 05:05:40 UTC 2018


We do this on other sink/source modules, and in general it makes sense
to do so here as well.
---
 src/modules/module-null-sink.c   | 4 ++++
 src/modules/module-null-source.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index 6cbe588de..fdab1121e 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -28,6 +28,7 @@
 
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
+#include <pulse/util.h>
 #include <pulse/xmalloc.h>
 
 #include <pulsecore/i18n.h>
@@ -206,6 +207,9 @@ static void thread_func(void *userdata) {
 
     pa_log_debug("Thread starting up");
 
+    if (u->core->realtime_scheduling)
+        pa_thread_make_realtime(u->core->realtime_priority);
+
     pa_thread_mq_install(&u->thread_mq);
 
     u->timestamp = pa_rtclock_now();
diff --git a/src/modules/module-null-source.c b/src/modules/module-null-source.c
index 0e4c8d2f2..251d0f523 100644
--- a/src/modules/module-null-source.c
+++ b/src/modules/module-null-source.c
@@ -29,6 +29,7 @@
 
 #include <pulse/rtclock.h>
 #include <pulse/timeval.h>
+#include <pulse/util.h>
 #include <pulse/xmalloc.h>
 
 #include <pulsecore/core-util.h>
@@ -132,6 +133,9 @@ static void thread_func(void *userdata) {
 
     pa_log_debug("Thread starting up");
 
+    if (u->core->realtime_scheduling)
+        pa_thread_make_realtime(u->core->realtime_priority);
+
     pa_thread_mq_install(&u->thread_mq);
 
     u->timestamp = pa_rtclock_now();
-- 
2.17.0



More information about the pulseaudio-discuss mailing list