From 09e8033c49272776bb2b2cb9a0ac676ee8f1b831 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Mon, 17 Jan 2022 17:34:16 -0500 Subject: [PATCH] alsa-source: Bring reconfigure in line with alsa-sink This got fixed for new API expectations (channel map will always be set), so keep things up-to-date. --- src/modules/alsa/alsa-source.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index feedf4e01..8a38fea96 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -1639,9 +1639,8 @@ static int source_reconfigure_cb(pa_source *s, pa_sample_spec *spec, pa_channel_ bool format_supported = false; bool rate_supported = false; bool channels_supported = false; -#ifdef USE_SMOOTHER_2 pa_sample_spec effective_spec; -#endif + pa_channel_map effective_map; pa_assert(u); @@ -1687,6 +1686,16 @@ static int source_reconfigure_cb(pa_source *s, pa_sample_spec *spec, pa_channel_ effective_spec.channels = u->verified_sample_spec.channels; } + /* We con't actually support configuring the channel map, so let's do the best we can */ + pa_channel_map_init_auto(&effective_map, effective_spec.channels, PA_CHANNEL_MAP_ALSA); + if (!pa_channel_map_equal(map, &effective_map)) { + char req_map_str[PA_CHANNEL_MAP_SNPRINT_MAX], eff_map_str[PA_CHANNEL_MAP_SNPRINT_MAX]; + + pa_log_info("Cannot set channel map to %s, using default of %s", + pa_channel_map_snprint(req_map_str, sizeof(req_map_str), map), + pa_channel_map_snprint(eff_map_str, sizeof(eff_map_str), &effective_map)); + } + pa_source_set_sample_spec(u->source, &effective_spec, map); #if USE_SMOOTHER_2