<p><br>
> > ><br>
> > > I'm researching a bug where some set of USB speakers stopped working,<br>
> > > probably in 2.x. The peculiar thing about this sound card is that seems<br>
> > > to only work at a sample rate of 46875 Hz.<br>
> > ><br>
> > > So in 2.x, the probe fails with<br>
> > > "E: [pulseaudio] alsa-sink.c: Failed to find any supported sample<br>
> > > rates.", whereas in an earlier version, it would just happily work at<br>
> > > 46875 Hz instead, as I understand it.<br>
> > ><br>
> > > So my first question is; why do we check all these rates, when we end up<br>
> > > just alternating between default-sample-rate (44100 Hz) and<br>
> > > alternate-sample-rate (48000 Hz) anyway?<br>
> ><br>
> > I don't have an answer for that.<br>
> ><br>
> > > And second, can we try not to fail if we can't find any supported sample<br>
> > > rates, so we can fix this regression?<br>
> ><br>
> > I don't see any fundamental reason why we couldn't support any crazy<br>
> > sample rate.<br>
> ><br>
> > > For reference, this is the bug (with pulse verbose logs in it):<br>
> > ><br>
> > > <a href="https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1074783">https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1074783</a><br>
> ><br>
> > A related bug: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=48109">https://bugs.freedesktop.org/show_bug.cgi?id=48109</a><br>
> ><br>
> > --<br>
> > Tanu<br>
> ><br>
> Hi.<br>
> I played around a bit and found seemingly a solution to this. I'm not sure<br>
> if this is the proper solution but it seems to work for me. Let me know<br>
> if I should clean this up a little further.<br>
><br>
> Patch attached.<br>
></p>
<p>+ if ((ret =snd_pcm_hw_params_get_rate_min(hwparams, &rate_min, &dir)) < 0) {<br>
+ pa_log_debug("snd_pcm_hw_params_get_rate_min() failed: %s", pa_alsa_strerror(ret));<br>
+ goto fallback;<br>
+ }<br>
+<br>
+ if ((ret =snd_pcm_hw_params_get_rate_max(hwparams, &rate_max, &dir)) < 0) {<br>
+ pa_log_debug("snd_pcm_hw_params_get_rate_max() failed: %s", pa_alsa_strerror(ret));<br>
+ goto fallback;<br>
+ }<br>
+ pa_log_debug("Found min - max rates: %d - %d", rate_min, rate_max);<br>
+<br>
+ for (i = rate_min, n = 0; i <= rate_max; i++) {<br>
+ if (snd_pcm_hw_params_test_rate(pcm, hwparams, i, 0) == 0) {<br>
+ rates = pa_xrealloc(rates, ++n * sizeof(unsigned int));<br>
+ rates[n-1] = i;<br>
+ }<br>
+ }</p>
<p>this create a extreme large array for those drivers which support SNDRV_PCM_RATE_CONTINUOUS</p>