diff options
author | Igor V. Kovalenko <igor.v.kovalenko@gmail.com> | 2023-02-22 01:19:24 +0300 |
---|---|---|
committer | PulseAudio Marge Bot <pulseaudio-maintainers@lists.freedesktop.org> | 2023-02-25 12:00:38 +0000 |
commit | aed52c507f345d0b5c4cd2b1d2c58dae2d904b53 (patch) | |
tree | 7f7fc3891f6cb6e11837a74ee94e587959fda15c /src/modules/alsa/alsa-sink.c | |
parent | b8e2198d34da2e085b469d7e3a472cbdaec9e5b8 (diff) | |
download | pulseaudio-aed52c507f345d0b5c4cd2b1d2c58dae2d904b53.tar.gz |
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)
Bug: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1414
Bug: https://github.com/alsa-project/alsa-lib/issues/119
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/782>
Diffstat (limited to 'src/modules/alsa/alsa-sink.c')
-rw-r--r-- | src/modules/alsa/alsa-sink.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index b249df680..ca22f195f 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -2527,7 +2527,9 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca &ss, &map, SND_PCM_STREAM_PLAYBACK, &period_frames, &buffer_frames, tsched_frames, - &b, &d, mapping))) + &b, &d, + &u->supported_formats, &u->supported_rates, + mapping))) goto fail; } else if ((dev_id = pa_modargs_get_value(ma, "device_id", NULL))) { @@ -2541,7 +2543,9 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca &ss, &map, SND_PCM_STREAM_PLAYBACK, &period_frames, &buffer_frames, tsched_frames, - &b, &d, profile_set, &mapping))) + &b, &d, + &u->supported_formats, &u->supported_rates, + profile_set, &mapping))) goto fail; } else { @@ -2552,7 +2556,9 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca &ss, &map, SND_PCM_STREAM_PLAYBACK, &period_frames, &buffer_frames, tsched_frames, - &b, &d, false))) + &b, &d, + &u->supported_formats, &u->supported_rates, + false))) goto fail; } @@ -2598,13 +2604,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca u->verified_sample_spec = ss; - u->supported_formats = pa_alsa_get_supported_formats(u->pcm_handle, ss.format); if (!u->supported_formats) { pa_log_error("Failed to find any supported sample formats."); goto fail; } - u->supported_rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate); if (!u->supported_rates) { pa_log_error("Failed to find any supported sample rates."); goto fail; |