X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmodules%2Falsa%2Falsa-util.c;h=b8d135758439bc18c80a2b245f69cb3e7a21df44;hb=53b046d5c9593d848270e85017c2999a61256e0e;hp=0e22d17e467aaca47d8f004940a3a5461717204d;hpb=c079ceeba00c77a93c613ecf4a3f2cb516db0753;p=platform%2Fupstream%2Fpulseaudio.git diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index 0e22d17..b8d1357 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "alsa-util.h" #include "alsa-mixer.h" @@ -1308,3 +1309,26 @@ const char* pa_alsa_strerror(int errnum) { return translated; } + +pa_bool_t pa_alsa_may_tsched(pa_bool_t want) { + + if (!want) + return FALSE; + + if (!pa_rtclock_hrtimer()) { + /* We cannot depend on being woken up in time when the timers + are inaccurate, so let's fallback to classic IO based playback + then. */ + pa_log_notice("Disabling timer-based scheduling because high-resolution timers are not available from the kernel."); + return FALSE; } + + if (pa_running_in_vm()) { + /* We cannot depend on being woken up when we ask for in a VM, + * so let's fallback to classic IO based playback then. */ + pa_log_notice("Disabling timer-based scheduling because running inside a VM."); + return FALSE; + } + + + return TRUE; +}