From ce02c7d435922df84c3ff79fb95d3bcf727b0e3f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 9 Dec 2021 16:00:19 +0100 Subject: [PATCH] channelmix: always handle 1 channel as mono Handle 1 channel as a mono channel, which gets copied to all outputs or gets the average of all inputs. Fixes the case where a mono channel is handled like a FRONT channel and then gets attenuated when mixed into left and right. --- spa/plugins/audioconvert/channelmix-ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spa/plugins/audioconvert/channelmix-ops.c b/spa/plugins/audioconvert/channelmix-ops.c index 1b99d5dfa..f28890eee 100644 --- a/spa/plugins/audioconvert/channelmix-ops.c +++ b/spa/plugins/audioconvert/channelmix-ops.c @@ -168,7 +168,9 @@ static int make_matrix(struct channelmix *mix) src_mask >>= 3; dst_mask >>= 3; - if (src_mask == 0 || dst_mask == 0) { + /* unknown channels or just 1 channel */ + if (src_mask == 0 || mix->src_chan == 1 || + dst_mask == 0 || mix->dst_chan == 1) { if (src_mask == FRONT && mix->src_chan == 1) { /* one FC/MONO src goes everywhere */ spa_log_debug(mix->log, "distribute FC/MONO");