mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
alsa: be a bit more verbose when a hwparam call fails
This commit is contained in:
parent
b7e2223186
commit
0cb383717e
1 changed files with 42 additions and 13 deletions
|
|
@ -272,6 +272,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)
|
||||
|
|
@ -298,6 +303,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++) {
|
||||
|
|
@ -305,6 +314,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;
|
||||
|
|
@ -338,11 +351,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) {
|
||||
|
||||
|
|
@ -350,14 +367,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;
|
||||
|
|
@ -365,19 +386,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)
|
||||
goto finish;
|
||||
} else {
|
||||
if ((ret = snd_pcm_hw_params_set_channels_near(pcm_handle, hwparams, &c)) < 0)
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((ret = snd_pcm_hw_params_set_periods_integer(pcm_handle, hwparams)) < 0)
|
||||
if (require_exact_channel_number) {
|
||||
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) {
|
||||
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) {
|
||||
pa_log_debug("snd_pcm_hw_params_set_periods_integer() failed: %s", pa_alsa_strerror(ret));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (_period_size && tsched_size && _periods) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue