Regression playing 24bit/96kHz audio on USB audio interface between 5.10.94 and 5.15.21

Takashi Iwai tiwai at suse.de
Sat Dec 31 14:20:56 CET 2022


On Sat, 31 Dec 2022 13:10:18 +0100,
Jaroslav Kysela wrote:
> 
> On 31. 12. 22 12:38, Ruud van Asseldonk wrote:
> > Hi all,
> > 
> > I bisected this and identified e4ea77f8e53f9accb9371fba34c189d0447ecce0
> > (ALSA: usb-audio: Always apply the hw constraints for implicit fb sync)
> > as the first commit where it is no longer possible to change the sample
> > rate. On the parent commit, my sample program successfully changes the
> > sample rate from 44100 Hz to 96000 Hz, but on e4ea77f8e53f9, the second
> > call to snd_pcm_hw_params fails.
> 
> There is an easy workaround - call snd_pcm_hw_free() between the
> params setup. This call ensure that the sync ep is freed. I can just
> confirm that this
> problem is only for USB hw with the implicit feedback (tested with 6.0.11 kernel).
> 
> I will try to debug this when I find a little free time. Perhaps,
> Takashi may have a straight idea, what's wrong. When only one stream
> is used, this hw_params call should succeed, too.

The patch like below might help (note: totally untested).

My wild guess is that it's an internal stream start for the implicit
fb case at prepare without actually starting a PCM stream, and it
wasn't stopped properly before the second hw_params call.


Takashi

-- 8< --
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -525,6 +525,8 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
 		if (snd_usb_endpoint_compatible(chip, subs->data_endpoint,
 						fmt, hw_params))
 			goto unlock;
+		if (stop_endpoints(subs, false))
+			sync_pending_stops(subs);
 		close_endpoints(chip, subs);
 	}
 


More information about the Alsa-devel mailing list