From: Lennart Poettering Date: Mon, 30 Mar 2009 16:00:23 +0000 (+0200) Subject: don't enabled tsched on software ALSA devices X-Git-Tag: v0.9.15-test6~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3f15104cf0386a0e0a782037e8c0323629be749;p=platform%2Fupstream%2Fpulseaudio.git don't enabled tsched on software ALSA devices --- diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 7c09553..0296f64 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1630,6 +1630,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca u->use_tsched = use_tsched = FALSE; } + if (use_tsched && !pa_alsa_pcm_is_hw(u->pcm_handle)) { + pa_log_info("Device is not a hardware device, disabling timer-based scheduling."); + u->use_tsched = use_tsched = FALSE; + } + if (u->use_mmap) pa_log_info("Successfully enabled mmap() mode."); diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index dfd1870..ef365a2 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -1482,6 +1482,11 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p u->use_tsched = use_tsched = FALSE; } + if (use_tsched && !pa_alsa_pcm_is_hw(u->pcm_handle)) { + pa_log_info("Device is not a hardware device, disabling timer-based scheduling."); + u->use_tsched = use_tsched = FALSE; + } + if (u->use_mmap) pa_log_info("Successfully enabled mmap() mode."); diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index 3f26aeb..2d0ca10 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -1716,10 +1716,11 @@ char *pa_alsa_get_driver_name(int card) { char *pa_alsa_get_driver_name_by_pcm(snd_pcm_t *pcm) { int card; - snd_pcm_info_t* info; snd_pcm_info_alloca(&info); + pa_assert(pcm); + if (snd_pcm_info(pcm, info) < 0) return NULL; @@ -1749,3 +1750,15 @@ char *pa_alsa_get_reserve_name(const char *device) { return pa_sprintf_malloc("Audio%i", i); } + +pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm) { + snd_pcm_info_t* info; + snd_pcm_info_alloca(&info); + + pa_assert(pcm); + + if (snd_pcm_info(pcm, info) < 0) + return FALSE; + + return snd_pcm_info_get_card(info) >= 0; +} diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h index fe0f71e..68496d5 100644 --- a/src/modules/alsa/alsa-util.h +++ b/src/modules/alsa/alsa-util.h @@ -139,4 +139,6 @@ char *pa_alsa_get_driver_name_by_pcm(snd_pcm_t *pcm); char *pa_alsa_get_reserve_name(const char *device); +pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm); + #endif