alsa-util: Perform format and rate detection before setting HW params

Perform detection of supported sample format and rates just after device is
opened, before `snd_pcm_hw_params()` is called for the first time. This fixes a
problem where device restricts available sample rates after HW params are set
preventing sample rate detection (seen with UAC2 devices and kernel 6.1.9)
This commit is contained in:
Wim Taymans 2023-03-20 18:22:09 +01:00
parent 43770c533c
commit 96ed03e1fc
6 changed files with 69 additions and 5 deletions

View file

@ -362,7 +362,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
devstr, NULL, &m->sample_spec,
&m->channel_map, SND_PCM_STREAM_PLAYBACK,
&try_period_size, &try_buffer_size,
0, NULL, NULL, false))) {
0, NULL, NULL, NULL, NULL, false))) {
pa_alsa_init_proplist_pcm(NULL, m->output_proplist, m->output_pcm);
pa_proplist_setf(m->output_proplist, "clock.name", "api.alsa.%u", index);
pa_alsa_close(&m->output_pcm);
@ -392,7 +392,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
devstr, NULL, &m->sample_spec,
&m->channel_map, SND_PCM_STREAM_CAPTURE,
&try_period_size, &try_buffer_size,
0, NULL, NULL, false))) {
0, NULL, NULL, NULL, NULL, false))) {
pa_alsa_init_proplist_pcm(NULL, m->input_proplist, m->input_pcm);
pa_proplist_setf(m->input_proplist, "clock.name", "api.alsa.%u", index);
pa_alsa_close(&m->input_pcm);