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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2018-05-06 at 10:35 +0530, Arun Raghavan wrote:
> 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();

Looks good to me.

-- 
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux