From e79cefb72334fc7c72e44b9bca8e310e1550ff63 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Mon, 17 Jan 2022 17:11:48 -0500 Subject: [PATCH] alsa-sink: Explicitly handle channel map reconfiguration We don't actually support it, but handle this path correctly. --- src/modules/alsa/alsa-sink.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index 46483a7e6..4ace094b7 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -1825,6 +1825,7 @@ static int sink_reconfigure_cb(pa_sink *s, pa_sample_spec *spec, pa_channel_map bool rate_supported = false; bool channels_supported = false; pa_sample_spec effective_spec; + pa_channel_map effective_map; pa_assert(u); @@ -1870,7 +1871,17 @@ static int sink_reconfigure_cb(pa_sink *s, pa_sample_spec *spec, pa_channel_map effective_spec.channels = u->verified_sample_spec.channels; } - pa_sink_set_sample_spec(u->sink, &effective_spec, map); + /* 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_sink_set_sample_spec(u->sink, &effective_spec, &effective_map); #ifdef USE_SMOOTHER_2 pa_smoother_2_set_sample_spec(u->smoother, pa_rtclock_now(), &effective_spec);