[pulseaudio-commits] Branch 'next' - 3 commits - configure.ac PROTOCOL src/map-file src/modules src/pulse src/pulsecore src/tests
Arun Raghavan
arun at kemper.freedesktop.org
Sun May 6 02:33:46 UTC 2018
PROTOCOL | 7 +
configure.ac | 2
src/map-file | 1
src/modules/alsa/alsa-sink.c | 3
src/modules/alsa/alsa-source.c | 3
src/modules/bluetooth/module-bluez5-device.c | 3
src/modules/jack/module-jack-sink.c | 5
src/modules/jack/module-jack-source.c | 5
src/modules/macosx/module-coreaudio-device.c | 2
src/modules/module-allow-passthrough.c | 6
src/modules/module-combine-sink.c | 3
src/modules/module-solaris.c | 2
src/modules/module-waveout.c | 2
src/modules/oss/module-oss.c | 2
src/pulse/util.c | 176 +++++++++++++++++++++++++++
src/pulse/util.h | 6
src/pulsecore/core-util.c | 171 --------------------------
src/pulsecore/core-util.h | 1
src/tests/lo-test-util.c | 2
src/tests/rtstutter.c | 2
20 files changed, 219 insertions(+), 185 deletions(-)
New commits:
commit de38a209f41dd2668ff6a72c047caadacc0a71a5
Author: Arun Raghavan <arun at arunraghavan.net>
Date: Fri May 4 21:59:23 2018 +0530
module-allow-passthrough: Don't crash if we can't find a sink
module-allow-passthrough has a (necessary) hack to replicate the default
sink selection and format negotiation from sink-input.c. One thing that
got missed in this replication is the possibility that the sink input is
not compatible with the default sink. When this happen, we now exit
gracefully.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=105578
diff --git a/src/modules/module-allow-passthrough.c b/src/modules/module-allow-passthrough.c
index 16b421d7..f7c61559 100644
--- a/src/modules/module-allow-passthrough.c
+++ b/src/modules/module-allow-passthrough.c
@@ -184,6 +184,12 @@ static pa_hook_result_t sink_input_new_cb(pa_core *core, pa_sink_input_new_data
if (!new_data->format && new_data->nego_formats && !pa_idxset_isempty(new_data->nego_formats))
new_data->format = pa_format_info_copy(pa_idxset_first(new_data->nego_formats, NULL));
+ if (!new_data->format) {
+ /* Sink doesn't support any requested format */
+ pa_log_debug("Default sink does not match sink input requested formats");
+ return PA_HOOK_OK;
+ }
+
if (pa_sink_input_new_data_is_passthrough(new_data))
return new_passthrough_stream(u, core, new_data->sink, NULL);
commit b38535636e4e4fc3b2981fe9a8dffede5a8889b1
Author: Arun Raghavan <arun at arunraghavan.net>
Date: Sat Apr 21 09:45:26 2018 +0530
core: Expose API to elevate a thread to realtime priority
This should make it easier for clients to elevate their audio threads to
real time priority without having to dig through much through specific
system internals.
diff --git a/src/map-file b/src/map-file
index 9b6cba22..7c1216ea 100644
--- a/src/map-file
+++ b/src/map-file
@@ -225,6 +225,7 @@ pa_mainloop_run;
pa_mainloop_set_poll_func;
pa_mainloop_wakeup;
pa_msleep;
+pa_thread_make_realtime
pa_operation_cancel;
pa_operation_get_state;
pa_operation_ref;
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index eb79a444..ed9e0a51 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -33,6 +33,7 @@
#include <pulse/rtclock.h>
#include <pulse/timeval.h>
+#include <pulse/util.h>
#include <pulse/volume.h>
#include <pulse/xmalloc.h>
#include <pulse/internal.h>
@@ -1780,7 +1781,7 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority);
+ pa_thread_make_realtime(u->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index ca85968e..31d5bb32 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -29,6 +29,7 @@
#include <pulse/rtclock.h>
#include <pulse/timeval.h>
+#include <pulse/util.h>
#include <pulse/volume.h>
#include <pulse/xmalloc.h>
@@ -1504,7 +1505,7 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority);
+ pa_thread_make_realtime(u->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index dfae682d..edabb900 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -30,6 +30,7 @@
#include <pulse/rtclock.h>
#include <pulse/timeval.h>
#include <pulse/utf8.h>
+#include <pulse/util.h>
#include <pulsecore/core-error.h>
#include <pulsecore/core-rtclock.h>
@@ -1428,7 +1429,7 @@ static void thread_func(void *userdata) {
pa_log_debug("IO Thread starting up");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority);
+ pa_thread_make_realtime(u->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
diff --git a/src/modules/jack/module-jack-sink.c b/src/modules/jack/module-jack-sink.c
index eb1d1b15..effa0dd0 100644
--- a/src/modules/jack/module-jack-sink.c
+++ b/src/modules/jack/module-jack-sink.c
@@ -29,6 +29,7 @@
#include <jack/jack.h>
+#include <pulse/util.h>
#include <pulse/xmalloc.h>
#include <pulsecore/sink.h>
@@ -224,7 +225,7 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority);
+ pa_thread_make_realtime(u->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
@@ -267,7 +268,7 @@ static void jack_init(void *arg) {
pa_log_info("JACK thread starting up.");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority+4);
+ pa_thread_make_realtime(u->core->realtime_priority+4);
}
/* JACK Callback: This is called when JACK kicks us */
diff --git a/src/modules/jack/module-jack-source.c b/src/modules/jack/module-jack-source.c
index 43cb0e15..eaf2cd81 100644
--- a/src/modules/jack/module-jack-source.c
+++ b/src/modules/jack/module-jack-source.c
@@ -29,6 +29,7 @@
#include <jack/jack.h>
+#include <pulse/util.h>
#include <pulse/xmalloc.h>
#include <pulsecore/source.h>
@@ -187,7 +188,7 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority);
+ pa_thread_make_realtime(u->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
@@ -225,7 +226,7 @@ static void jack_init(void *arg) {
pa_log_info("JACK thread starting up.");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority+4);
+ pa_thread_make_realtime(u->core->realtime_priority+4);
}
static void jack_shutdown(void* arg) {
diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c
index 149109d4..b9dffb93 100644
--- a/src/modules/macosx/module-coreaudio-device.c
+++ b/src/modules/macosx/module-coreaudio-device.c
@@ -722,7 +722,7 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up");
if (u->module->core->realtime_scheduling)
- pa_make_realtime(u->module->core->realtime_priority);
+ pa_thread_make_realtime(u->module->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c
index f7649a36..b7dac804 100644
--- a/src/modules/module-combine-sink.c
+++ b/src/modules/module-combine-sink.c
@@ -26,6 +26,7 @@
#include <pulse/rtclock.h>
#include <pulse/timeval.h>
+#include <pulse/util.h>
#include <pulse/xmalloc.h>
#include <pulsecore/macro.h>
@@ -319,7 +320,7 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority+1);
+ pa_thread_make_realtime(u->core->realtime_priority+1);
pa_thread_mq_install(&u->thread_mq);
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index 240ed855..038aca11 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -650,7 +650,7 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority);
+ pa_thread_make_realtime(u->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
diff --git a/src/modules/module-waveout.c b/src/modules/module-waveout.c
index 08b44aff..f7ffdf75 100644
--- a/src/modules/module-waveout.c
+++ b/src/modules/module-waveout.c
@@ -252,7 +252,7 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority);
+ pa_thread_make_realtime(u->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index 6a70f9af..ed124cab 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -899,7 +899,7 @@ static void thread_func(void *userdata) {
pa_log_debug("Thread starting up");
if (u->core->realtime_scheduling)
- pa_make_realtime(u->core->realtime_priority);
+ pa_thread_make_realtime(u->core->realtime_priority);
pa_thread_mq_install(&u->thread_mq);
diff --git a/src/pulse/util.c b/src/pulse/util.c
index 54fe7a28..2be389b2 100644
--- a/src/pulse/util.c
+++ b/src/pulse/util.c
@@ -56,6 +56,7 @@
#include <pulse/timeval.h>
#include <pulsecore/socket.h>
+#include <pulsecore/core-error.h>
#include <pulsecore/core-util.h>
#include <pulsecore/macro.h>
#include <pulsecore/usergroup.h>
@@ -71,6 +72,29 @@
static int _main() PA_GCC_WEAKREF(main);
#endif
+#ifdef HAVE_PTHREAD
+#include <pthread.h>
+#endif
+
+#ifdef HAVE_SCHED_H
+#include <sched.h>
+
+#if defined(__linux__) && !defined(SCHED_RESET_ON_FORK)
+#define SCHED_RESET_ON_FORK 0x40000000
+#endif
+#endif
+
+#ifdef __APPLE__
+#include <mach/mach_init.h>
+#include <mach/thread_act.h>
+#include <mach/thread_policy.h>
+#include <sys/sysctl.h>
+#endif
+
+#ifdef HAVE_DBUS
+#include <pulsecore/rtkit.h>
+#endif
+
char *pa_get_user_name(char *s, size_t l) {
const char *p;
char *name = NULL;
@@ -342,3 +366,155 @@ int pa_msleep(unsigned long t) {
#error "Platform lacks a sleep function."
#endif
}
+
+#ifdef _POSIX_PRIORITY_SCHEDULING
+static int set_scheduler(int rtprio) {
+#ifdef HAVE_SCHED_H
+ struct sched_param sp;
+#ifdef HAVE_DBUS
+ int r;
+ long long rttime;
+#ifdef RLIMIT_RTTIME
+ struct rlimit rl;
+#endif
+ DBusError error;
+ DBusConnection *bus;
+
+ dbus_error_init(&error);
+#endif
+
+ pa_zero(sp);
+ sp.sched_priority = rtprio;
+
+#ifdef SCHED_RESET_ON_FORK
+ if (pthread_setschedparam(pthread_self(), SCHED_RR|SCHED_RESET_ON_FORK, &sp) == 0) {
+ pa_log_debug("SCHED_RR|SCHED_RESET_ON_FORK worked.");
+ return 0;
+ }
+#endif
+
+ if (pthread_setschedparam(pthread_self(), SCHED_RR, &sp) == 0) {
+ pa_log_debug("SCHED_RR worked.");
+ return 0;
+ }
+#endif /* HAVE_SCHED_H */
+
+#ifdef HAVE_DBUS
+ /* Try to talk to RealtimeKit */
+
+ if (!(bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error))) {
+ pa_log("Failed to connect to system bus: %s", error.message);
+ dbus_error_free(&error);
+ errno = -EIO;
+ return -1;
+ }
+
+ /* We need to disable exit on disconnect because otherwise
+ * dbus_shutdown will kill us. See
+ * https://bugs.freedesktop.org/show_bug.cgi?id=16924 */
+ dbus_connection_set_exit_on_disconnect(bus, FALSE);
+
+ rttime = rtkit_get_rttime_usec_max(bus);
+ if (rttime >= 0) {
+#ifdef RLIMIT_RTTIME
+ r = getrlimit(RLIMIT_RTTIME, &rl);
+
+ if (r >= 0 && (long long) rl.rlim_max > rttime) {
+ pa_log_info("Clamping rlimit-rttime to %lld for RealtimeKit", rttime);
+ rl.rlim_cur = rl.rlim_max = rttime;
+ r = setrlimit(RLIMIT_RTTIME, &rl);
+
+ if (r < 0)
+ pa_log("setrlimit() failed: %s", pa_cstrerror(errno));
+ }
+#endif
+ r = rtkit_make_realtime(bus, 0, rtprio);
+ dbus_connection_close(bus);
+ dbus_connection_unref(bus);
+
+ if (r >= 0) {
+ pa_log_debug("RealtimeKit worked.");
+ return 0;
+ }
+
+ errno = -r;
+ } else {
+ dbus_connection_close(bus);
+ dbus_connection_unref(bus);
+ errno = -rttime;
+ }
+
+#else
+ errno = 0;
+#endif
+
+ return -1;
+}
+#endif
+
+/* Make the current thread a realtime thread, and acquire the highest
+ * rtprio we can get that is less or equal the specified parameter. If
+ * the thread is already realtime, don't do anything. */
+int pa_thread_make_realtime(int rtprio) {
+
+#if defined(OS_IS_DARWIN)
+ struct thread_time_constraint_policy ttcpolicy;
+ uint64_t freq = 0;
+ size_t size = sizeof(freq);
+ int ret;
+
+ ret = sysctlbyname("hw.cpufrequency", &freq, &size, NULL, 0);
+ if (ret < 0) {
+ pa_log_info("Unable to read CPU frequency, acquisition of real-time scheduling failed.");
+ return -1;
+ }
+
+ pa_log_debug("sysctl for hw.cpufrequency: %llu", freq);
+
+ /* See http://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html */
+ ttcpolicy.period = freq / 160;
+ ttcpolicy.computation = freq / 3300;
+ ttcpolicy.constraint = freq / 2200;
+ ttcpolicy.preemptible = 1;
+
+ ret = thread_policy_set(mach_thread_self(),
+ THREAD_TIME_CONSTRAINT_POLICY,
+ (thread_policy_t) &ttcpolicy,
+ THREAD_TIME_CONSTRAINT_POLICY_COUNT);
+ if (ret) {
+ pa_log_info("Unable to set real-time thread priority (%08x).", ret);
+ return -1;
+ }
+
+ pa_log_info("Successfully acquired real-time thread priority.");
+ return 0;
+
+#elif defined(_POSIX_PRIORITY_SCHEDULING)
+ int p;
+
+ if (set_scheduler(rtprio) >= 0) {
+ pa_log_info("Successfully enabled SCHED_RR scheduling for thread, with priority %i.", rtprio);
+ return 0;
+ }
+
+ for (p = rtprio-1; p >= 1; p--)
+ if (set_scheduler(p) >= 0) {
+ pa_log_info("Successfully enabled SCHED_RR scheduling for thread, with priority %i, which is lower than the requested %i.", p, rtprio);
+ return 0;
+ }
+#elif defined(OS_IS_WIN32)
+ /* Windows only allows realtime scheduling to be set on a per process basis.
+ * Therefore, instead of making the thread realtime, just give it the highest non-realtime priority. */
+ if (SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)) {
+ pa_log_info("Successfully enabled THREAD_PRIORITY_TIME_CRITICAL scheduling for thread.");
+ return 0;
+ }
+
+ pa_log_warn("SetThreadPriority() failed: 0x%08X", GetLastError());
+ errno = EPERM;
+#else
+ errno = ENOTSUP;
+#endif
+ pa_log_info("Failed to acquire real-time scheduling: %s", pa_cstrerror(errno));
+ return -1;
+}
diff --git a/src/pulse/util.h b/src/pulse/util.h
index e4a62da6..0717a73f 100644
--- a/src/pulse/util.h
+++ b/src/pulse/util.h
@@ -54,6 +54,12 @@ char *pa_path_get_filename(const char *p);
/** Wait t milliseconds */
int pa_msleep(unsigned long t);
+/** Make the calling thread realtime if we can. On Linux, this uses RealTimeKit
+ * if available and POSIX APIs otherwise (the latter applies to other UNIX
+ * variants as well). This is also implemented for macOS and Windows.
+ * \since 13.0 */
+int pa_thread_make_realtime(int rtprio);
+
PA_C_DECL_END
#endif
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 7f627539..367e767d 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -61,14 +61,6 @@
#endif
#endif
-#ifdef HAVE_SCHED_H
-#include <sched.h>
-
-#if defined(__linux__) && !defined(SCHED_RESET_ON_FORK)
-#define SCHED_RESET_ON_FORK 0x40000000
-#endif
-#endif
-
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
@@ -109,15 +101,8 @@
#include <samplerate.h>
#endif
-#ifdef __APPLE__
-#include <mach/mach_init.h>
-#include <mach/thread_act.h>
-#include <mach/thread_policy.h>
-#include <sys/sysctl.h>
-#endif
-
#ifdef HAVE_DBUS
-#include "rtkit.h"
+#include <pulsecore/rtkit.h>
#endif
#if defined(__linux__) && !defined(__ANDROID__)
@@ -697,158 +682,6 @@ char *pa_strlcpy(char *b, const char *s, size_t l) {
return b;
}
-#ifdef _POSIX_PRIORITY_SCHEDULING
-static int set_scheduler(int rtprio) {
-#ifdef HAVE_SCHED_H
- struct sched_param sp;
-#ifdef HAVE_DBUS
- int r;
- long long rttime;
-#ifdef RLIMIT_RTTIME
- struct rlimit rl;
-#endif
- DBusError error;
- DBusConnection *bus;
-
- dbus_error_init(&error);
-#endif
-
- pa_zero(sp);
- sp.sched_priority = rtprio;
-
-#ifdef SCHED_RESET_ON_FORK
- if (pthread_setschedparam(pthread_self(), SCHED_RR|SCHED_RESET_ON_FORK, &sp) == 0) {
- pa_log_debug("SCHED_RR|SCHED_RESET_ON_FORK worked.");
- return 0;
- }
-#endif
-
- if (pthread_setschedparam(pthread_self(), SCHED_RR, &sp) == 0) {
- pa_log_debug("SCHED_RR worked.");
- return 0;
- }
-#endif /* HAVE_SCHED_H */
-
-#ifdef HAVE_DBUS
- /* Try to talk to RealtimeKit */
-
- if (!(bus = dbus_bus_get_private(DBUS_BUS_SYSTEM, &error))) {
- pa_log("Failed to connect to system bus: %s", error.message);
- dbus_error_free(&error);
- errno = -EIO;
- return -1;
- }
-
- /* We need to disable exit on disconnect because otherwise
- * dbus_shutdown will kill us. See
- * https://bugs.freedesktop.org/show_bug.cgi?id=16924 */
- dbus_connection_set_exit_on_disconnect(bus, FALSE);
-
- rttime = rtkit_get_rttime_usec_max(bus);
- if (rttime >= 0) {
-#ifdef RLIMIT_RTTIME
- r = getrlimit(RLIMIT_RTTIME, &rl);
-
- if (r >= 0 && (long long) rl.rlim_max > rttime) {
- pa_log_info("Clamping rlimit-rttime to %lld for RealtimeKit", rttime);
- rl.rlim_cur = rl.rlim_max = rttime;
- r = setrlimit(RLIMIT_RTTIME, &rl);
-
- if (r < 0)
- pa_log("setrlimit() failed: %s", pa_cstrerror(errno));
- }
-#endif
- r = rtkit_make_realtime(bus, 0, rtprio);
- dbus_connection_close(bus);
- dbus_connection_unref(bus);
-
- if (r >= 0) {
- pa_log_debug("RealtimeKit worked.");
- return 0;
- }
-
- errno = -r;
- } else {
- dbus_connection_close(bus);
- dbus_connection_unref(bus);
- errno = -rttime;
- }
-
-#else
- errno = 0;
-#endif
-
- return -1;
-}
-#endif
-
-/* Make the current thread a realtime thread, and acquire the highest
- * rtprio we can get that is less or equal the specified parameter. If
- * the thread is already realtime, don't do anything. */
-int pa_make_realtime(int rtprio) {
-
-#if defined(OS_IS_DARWIN)
- struct thread_time_constraint_policy ttcpolicy;
- uint64_t freq = 0;
- size_t size = sizeof(freq);
- int ret;
-
- ret = sysctlbyname("hw.cpufrequency", &freq, &size, NULL, 0);
- if (ret < 0) {
- pa_log_info("Unable to read CPU frequency, acquisition of real-time scheduling failed.");
- return -1;
- }
-
- pa_log_debug("sysctl for hw.cpufrequency: %llu", freq);
-
- /* See http://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html */
- ttcpolicy.period = freq / 160;
- ttcpolicy.computation = freq / 3300;
- ttcpolicy.constraint = freq / 2200;
- ttcpolicy.preemptible = 1;
-
- ret = thread_policy_set(mach_thread_self(),
- THREAD_TIME_CONSTRAINT_POLICY,
- (thread_policy_t) &ttcpolicy,
- THREAD_TIME_CONSTRAINT_POLICY_COUNT);
- if (ret) {
- pa_log_info("Unable to set real-time thread priority (%08x).", ret);
- return -1;
- }
-
- pa_log_info("Successfully acquired real-time thread priority.");
- return 0;
-
-#elif defined(_POSIX_PRIORITY_SCHEDULING)
- int p;
-
- if (set_scheduler(rtprio) >= 0) {
- pa_log_info("Successfully enabled SCHED_RR scheduling for thread, with priority %i.", rtprio);
- return 0;
- }
-
- for (p = rtprio-1; p >= 1; p--)
- if (set_scheduler(p) >= 0) {
- pa_log_info("Successfully enabled SCHED_RR scheduling for thread, with priority %i, which is lower than the requested %i.", p, rtprio);
- return 0;
- }
-#elif defined(OS_IS_WIN32)
- /* Windows only allows realtime scheduling to be set on a per process basis.
- * Therefore, instead of making the thread realtime, just give it the highest non-realtime priority. */
- if (SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)) {
- pa_log_info("Successfully enabled THREAD_PRIORITY_TIME_CRITICAL scheduling for thread.");
- return 0;
- }
-
- pa_log_warn("SetThreadPriority() failed: 0x%08X", GetLastError());
- errno = EPERM;
-#else
- errno = ENOTSUP;
-#endif
- pa_log_info("Failed to acquire real-time scheduling: %s", pa_cstrerror(errno));
- return -1;
-}
-
#ifdef HAVE_SYS_RESOURCE_H
static int set_nice(int nice_level) {
#ifdef HAVE_DBUS
@@ -935,7 +768,7 @@ int pa_raise_priority(int nice_level) {
}
/* Reset the priority to normal, inverting the changes made by
- * pa_raise_priority() and pa_make_realtime()*/
+ * pa_raise_priority() and pa_thread_make_realtime()*/
void pa_reset_priority(void) {
#ifdef HAVE_SYS_RESOURCE_H
struct sched_param sp;
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index e28b6aa7..32579739 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -81,7 +81,6 @@ char *pa_strlcpy(char *b, const char *s, size_t l);
char *pa_parent_dir(const char *fn);
-int pa_make_realtime(int rtprio);
int pa_raise_priority(int nice_level);
void pa_reset_priority(void);
diff --git a/src/tests/lo-test-util.c b/src/tests/lo-test-util.c
index fae91a22..40002a2c 100644
--- a/src/tests/lo-test-util.c
+++ b/src/tests/lo-test-util.c
@@ -208,7 +208,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_READY: {
pa_buffer_attr buffer_attr;
- pa_make_realtime(4);
+ pa_thread_make_realtime(4);
/* Create playback stream */
buffer_attr.maxlength = -1;
diff --git a/src/tests/rtstutter.c b/src/tests/rtstutter.c
index 7bd88080..56b5146c 100644
--- a/src/tests/rtstutter.c
+++ b/src/tests/rtstutter.c
@@ -57,7 +57,7 @@ static void work(void *p) {
pa_log_notice("CPU%i: Created thread.", PA_PTR_TO_UINT(p));
- pa_make_realtime(12);
+ pa_thread_make_realtime(12);
#ifdef HAVE_PTHREAD_SETAFFINITY_NP
{
commit c249ee37a92e8979d85a25171df25a224e9f1e0b
Author: Arun Raghavan <arun at arunraghavan.net>
Date: Fri May 4 22:46:53 2018 +0530
PROTOCOL: Bump to version 33
Required for the addition of new pa_encoding_t values.
diff --git a/PROTOCOL b/PROTOCOL
index 546998b7..8117d004 100644
--- a/PROTOCOL
+++ b/PROTOCOL
@@ -420,6 +420,13 @@ memfd support only to 10.0+ clients.
Check commit 451d1d676237c81 for further details.
+## v33, implemented by >= 13.0
+
+Added two values to the pa_encoding_t enum:
+
+ PA_ENCODING_TRUEHD_IEC61937 := 7
+ PA_ENCODING_DTSHD_IEC61937 := 8
+
#### If you just changed the protocol, read this
## module-tunnel depends on the sink/source/sink-input/source-input protocol
## internals, so if you changed these, you might have broken module-tunnel.
diff --git a/configure.ac b/configure.ac
index b0855a46..1a49c5e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,7 +40,7 @@ AC_SUBST(PA_MINOR, pa_minor)
AC_SUBST(PA_MAJORMINOR, pa_major.pa_minor)
AC_SUBST(PA_API_VERSION, 12)
-AC_SUBST(PA_PROTOCOL_VERSION, 32)
+AC_SUBST(PA_PROTOCOL_VERSION, 33)
# The stable ABI for client applications, for the version info x:y:z
# always will hold y=z
More information about the pulseaudio-commits
mailing list