From 6e6385e27d1a551af0631e437a03440a529c7745 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 2 Jun 2022 12:54:04 +0200 Subject: [PATCH] acp: don't mix non-AUX and AUX channels When filling up the channels, either fill up the positions with one of the know layouts or use AUX channels, never try to mix them. This avoid cards with a large number channels to show a strange mix of surround and AUX channels. --- spa/plugins/alsa/acp/channelmap.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/spa/plugins/alsa/acp/channelmap.h b/spa/plugins/alsa/acp/channelmap.h index daa63cc44..adb486809 100644 --- a/spa/plugins/alsa/acp/channelmap.h +++ b/spa/plugins/alsa/acp/channelmap.h @@ -196,17 +196,10 @@ static inline pa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsign static inline pa_channel_map* pa_channel_map_init_extend(pa_channel_map *m, unsigned channels, pa_channel_map_def_t def) { - unsigned i, c; - pa_channel_map_init(m); - for (c = channels; c > 0; c--) { - if (pa_channel_map_init_auto(m, c, def) == NULL) - continue; - for (i = 0; c < channels; c++, i++) - m->map[c] = PA_CHANNEL_POSITION_AUX0 + (i & 31); - m->channels = (uint8_t) channels; - return m; - } - return NULL; + pa_channel_map *r; + if ((r = pa_channel_map_init_auto(m, channels, def)) != NULL) + return r; + return pa_channel_map_init_auto(m, channels, PA_CHANNEL_MAP_AUX); } typedef uint64_t pa_channel_position_mask_t;