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.
This commit is contained in:
Arun Raghavan 2022-01-17 17:34:16 -05:00
parent e79cefb723
commit 09e8033c49

View file

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