# HG changeset patch # User William Pitcock # Date 1247517467 18000 # Node ID d2e01ca063359111b8f80bbbc2c905025447afd5 # Parent 0f7180e3b1631a717d8cd94e68c6a7b410746b9f alsa-ng: Work around *broken* drivers, such as snd-au88xx. diff -r 0f7180e3b163 -r d2e01ca06335 src/alsa-ng/alsa-core.c --- a/src/alsa-ng/alsa-core.c Sun Jul 12 08:30:13 2009 -0500 +++ b/src/alsa-ng/alsa-core.c Mon Jul 13 15:37:47 2009 -0500 @@ -308,6 +308,7 @@ gint err, bitwidth, ringbuf_size, buf_size; snd_pcm_format_t afmt; snd_pcm_hw_params_t *hwparams = NULL; + guint rate_ = rate; afmt = alsaplug_format_convert(fmt); if (afmt == SND_PCM_FORMAT_UNKNOWN) @@ -331,7 +332,14 @@ snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); snd_pcm_hw_params_set_format(pcm_handle, hwparams, afmt); snd_pcm_hw_params_set_channels(pcm_handle, hwparams, nch); - snd_pcm_hw_params_set_rate(pcm_handle, hwparams, rate, 0); + snd_pcm_hw_params_set_rate_resample(pcm_handle, hwparams, 1); + + snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &rate_, 0); + if (rate_ != rate) + { + _ERROR("sample rate %d is not supported (got %d)", rate, rate_); + return -1; + } err = snd_pcm_hw_params(pcm_handle, hwparams); if (err < 0)