alsa-sink: Explicitly handle channel map reconfiguration

We don't actually support it, but handle this path correctly.
This commit is contained in:
Arun Raghavan 2022-01-17 17:11:48 -05:00
parent 9f3e82ac31
commit e79cefb723

View file

@ -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);