forked from pool/pulseaudio
122 lines
4.8 KiB
Diff
122 lines
4.8 KiB
Diff
|
From a8bcf9b8435eddcc8bdaff7c5fd7d8a97d33dbd8 Mon Sep 17 00:00:00 2001
|
||
|
From: Lennart Poettering <lennart@poettering.net>
|
||
|
Date: Thu, 14 May 2009 01:25:07 +0200
|
||
|
Subject: [PATCH] alsa: be a bit more verbose when a hwparam call fails
|
||
|
|
||
|
---
|
||
|
src/modules/alsa/alsa-util.c | 45 ++++++++++++++++++++++++++++++++++-------
|
||
|
1 files changed, 37 insertions(+), 8 deletions(-)
|
||
|
|
||
|
diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
|
||
|
index 34cb6d6..b3de415 100644
|
||
|
--- a/src/modules/alsa/alsa-util.c
|
||
|
+++ b/src/modules/alsa/alsa-util.c
|
||
|
@@ -279,6 +279,11 @@ static int set_format(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hwparams, pa_s
|
||
|
if ((ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[*f])) >= 0)
|
||
|
return ret;
|
||
|
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_format(%s) failed: %s",
|
||
|
+ snd_pcm_format_description(format_trans[*f]),
|
||
|
+ pa_alsa_strerror(ret));
|
||
|
+
|
||
|
+
|
||
|
if (*f == PA_SAMPLE_FLOAT32BE)
|
||
|
*f = PA_SAMPLE_FLOAT32LE;
|
||
|
else if (*f == PA_SAMPLE_FLOAT32LE)
|
||
|
@@ -305,6 +310,10 @@ static int set_format(snd_pcm_t *pcm_handle, snd_pcm_hw_params_t *hwparams, pa_s
|
||
|
if ((ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[*f])) >= 0)
|
||
|
return ret;
|
||
|
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_format(%s) failed: %s",
|
||
|
+ snd_pcm_format_description(format_trans[*f]),
|
||
|
+ pa_alsa_strerror(ret));
|
||
|
+
|
||
|
try_auto:
|
||
|
|
||
|
for (i = 0; try_order[i] != PA_SAMPLE_INVALID; i++) {
|
||
|
@@ -312,6 +321,10 @@ try_auto:
|
||
|
|
||
|
if ((ret = snd_pcm_hw_params_set_format(pcm_handle, hwparams, format_trans[*f])) >= 0)
|
||
|
return ret;
|
||
|
+
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_format(%s) failed: %s",
|
||
|
+ snd_pcm_format_description(format_trans[*f]),
|
||
|
+ pa_alsa_strerror(ret));
|
||
|
}
|
||
|
|
||
|
return -1;
|
||
|
@@ -345,11 +358,15 @@ int pa_alsa_set_hw_params(
|
||
|
|
||
|
snd_pcm_hw_params_alloca(&hwparams);
|
||
|
|
||
|
- if ((ret = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0)
|
||
|
+ if ((ret = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0) {
|
||
|
+ pa_log_debug("snd_pcm_hw_params_any() failed: %s", pa_alsa_strerror(ret));
|
||
|
goto finish;
|
||
|
+ }
|
||
|
|
||
|
- if ((ret = snd_pcm_hw_params_set_rate_resample(pcm_handle, hwparams, 0)) < 0)
|
||
|
+ if ((ret = snd_pcm_hw_params_set_rate_resample(pcm_handle, hwparams, 0)) < 0) {
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_rate_resample() failed: %s", pa_alsa_strerror(ret));
|
||
|
goto finish;
|
||
|
+ }
|
||
|
|
||
|
if (_use_mmap) {
|
||
|
|
||
|
@@ -357,14 +374,18 @@ int pa_alsa_set_hw_params(
|
||
|
|
||
|
/* mmap() didn't work, fall back to interleaved */
|
||
|
|
||
|
- if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
|
||
|
+ if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_access() failed: %s", pa_alsa_strerror(ret));
|
||
|
goto finish;
|
||
|
+ }
|
||
|
|
||
|
_use_mmap = FALSE;
|
||
|
}
|
||
|
|
||
|
- } else if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
|
||
|
+ } else if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_access() failed: %s", pa_alsa_strerror(ret));
|
||
|
goto finish;
|
||
|
+ }
|
||
|
|
||
|
if (!_use_mmap)
|
||
|
_use_tsched = FALSE;
|
||
|
@@ -372,19 +393,27 @@ int pa_alsa_set_hw_params(
|
||
|
if ((ret = set_format(pcm_handle, hwparams, &f)) < 0)
|
||
|
goto finish;
|
||
|
|
||
|
- if ((ret = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &r, NULL)) < 0)
|
||
|
+ if ((ret = snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &r, NULL)) < 0) {
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_rate_near() failed: %s", pa_alsa_strerror(ret));
|
||
|
goto finish;
|
||
|
+ }
|
||
|
|
||
|
if (require_exact_channel_number) {
|
||
|
- if ((ret = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, c)) < 0)
|
||
|
+ if ((ret = snd_pcm_hw_params_set_channels(pcm_handle, hwparams, c)) < 0) {
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_channels() failed: %s", pa_alsa_strerror(ret));
|
||
|
goto finish;
|
||
|
+ }
|
||
|
} else {
|
||
|
- if ((ret = snd_pcm_hw_params_set_channels_near(pcm_handle, hwparams, &c)) < 0)
|
||
|
+ if ((ret = snd_pcm_hw_params_set_channels_near(pcm_handle, hwparams, &c)) < 0) {
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_channels_near() failed: %s", pa_alsa_strerror(ret));
|
||
|
goto finish;
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
- if ((ret = snd_pcm_hw_params_set_periods_integer(pcm_handle, hwparams)) < 0)
|
||
|
+ if ((ret = snd_pcm_hw_params_set_periods_integer(pcm_handle, hwparams)) < 0) {
|
||
|
+ pa_log_debug("snd_pcm_hw_params_set_periods_integer() failed: %s", pa_alsa_strerror(ret));
|
||
|
goto finish;
|
||
|
+ }
|
||
|
|
||
|
if (_period_size && tsched_size && _periods) {
|
||
|
|
||
|
--
|
||
|
1.6.0.2
|
||
|
|