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

@ -64,6 +64,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto(
snd_pcm_uframes_t tsched_size,
bool *use_mmap, /* modified at return */
bool *use_tsched, /* modified at return */
pa_sample_format_t **query_supported_formats, /* modified at return */
unsigned int **query_supported_rates, /* modified at return */
pa_alsa_profile_set *ps,
pa_alsa_mapping **mapping); /* modified at return */
#endif
@ -80,6 +82,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_mapping(
snd_pcm_uframes_t tsched_size,
bool *use_mmap, /* modified at return */
bool *use_tsched, /* modified at return */
pa_sample_format_t **query_supported_formats, /* modified at return */
unsigned int **query_supported_rates, /* modified at return */
pa_alsa_mapping *mapping);
/* Opens the explicit ALSA device */
@ -94,6 +98,8 @@ snd_pcm_t *pa_alsa_open_by_device_string(
snd_pcm_uframes_t tsched_size,
bool *use_mmap, /* modified at return */
bool *use_tsched, /* modified at return */
pa_sample_format_t **query_supported_formats, /* modified at return */
unsigned int **query_supported_rates, /* modified at return */
bool require_exact_channel_number);
/* Opens the explicit ALSA device with a fallback list */
@ -109,6 +115,8 @@ snd_pcm_t *pa_alsa_open_by_template(
snd_pcm_uframes_t tsched_size,
bool *use_mmap, /* modified at return */
bool *use_tsched, /* modified at return */
pa_sample_format_t **query_supported_formats, /* modified at return */
unsigned int **query_supported_rates, /* modified at return */
bool require_exact_channel_number);
#if 0