[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.13-274-g5793f93
Lennart Poettering
gitmailer-noreply at 0pointer.de
Fri Jan 16 10:58:08 PST 2009
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The master branch has been updated
from 4a137637976360e94dfc304c291b3166b3c03970 (commit)
- Log -----------------------------------------------------------------
5793f93... make use of PR_SET_TIMERSLACK
-----------------------------------------------------------------------
Summary of changes:
src/daemon/main.c | 2 ++
src/pulsecore/rtclock.c | 26 ++++++++++++++++++++++++++
src/pulsecore/rtclock.h | 1 +
3 files changed, 29 insertions(+), 0 deletions(-)
-----------------------------------------------------------------------
commit 5793f93350dd8f29b7bc97eb1ad38873e4ecebde
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Jan 16 19:57:58 2009 +0100
make use of PR_SET_TIMERSLACK
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 08f65e6..b01689f 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -885,6 +885,8 @@ int main(int argc, char *argv[]) {
else
pa_log_info(_("Dude, your kernel stinks! The chef's recommendation today is Linux with high-resolution timers enabled!"));
+ pa_rtclock_hrtimer_enable();
+
#ifdef SIGRTMIN
/* Valgrind uses SIGRTMAX. To easy debugging we don't use it here */
pa_rtsig_configure(SIGRTMIN, SIGRTMAX-1);
diff --git a/src/pulsecore/rtclock.c b/src/pulsecore/rtclock.c
index f33de83..5fc6da2 100644
--- a/src/pulsecore/rtclock.c
+++ b/src/pulsecore/rtclock.c
@@ -27,9 +27,12 @@
#include <stddef.h>
#include <time.h>
#include <sys/time.h>
+#include <sys/prctl.h>
+#include <errno.h>
#include <pulse/timeval.h>
#include <pulsecore/macro.h>
+#include <pulsecore/core-error.h>
#include "rtclock.h"
@@ -89,6 +92,29 @@ pa_bool_t pa_rtclock_hrtimer(void) {
#endif
}
+void pa_rtclock_hrtimer_enable(void) {
+#ifdef PR_SET_TIMERSLACK
+ int slack_ns;
+
+ if ((slack_ns = prctl(PR_GET_TIMERSLACK, 0, 0, 0, 0)) < 0) {
+ pa_log_info("PR_GET_TIMERSLACK/PR_SET_TIMERSLACK not supported.");
+ return;
+ }
+
+ pa_log_debug("Timer slack set to %i us.", slack_ns/1000);
+
+ slack_ns = 500000000;
+
+ pa_log_debug("Setting timer slack to %i us.", slack_ns/1000);
+
+ if (prctl(PR_SET_TIMERSLACK, slack_ns, 0, 0, 0) < 0) {
+ pa_log_warn("PR_SET_TIMERSLACK failed: %s", pa_cstrerror(errno));
+ return;
+ }
+
+#endif
+}
+
pa_usec_t pa_rtclock_usec(void) {
struct timeval tv;
diff --git a/src/pulsecore/rtclock.h b/src/pulsecore/rtclock.h
index aa2cdac..281461d 100644
--- a/src/pulsecore/rtclock.h
+++ b/src/pulsecore/rtclock.h
@@ -35,6 +35,7 @@ pa_usec_t pa_rtclock_usec(void);
pa_usec_t pa_rtclock_age(const struct timeval *tv);
pa_bool_t pa_rtclock_hrtimer(void);
+void pa_rtclock_hrtimer_enable(void);
/* timer with a resolution better than this are considered high-resolution */
#define PA_HRTIMER_THRESHOLD_USEC 10
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list