From 2df10d1a400f99b0303f0f1af6c8e5ffa8e76510 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 29 Sep 2020 12:01:39 +0200 Subject: [PATCH] channelmix: reset the volume if the channels changed. --- spa/plugins/audioconvert/channelmix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spa/plugins/audioconvert/channelmix.c b/spa/plugins/audioconvert/channelmix.c index 337c03355..6be7ecaf6 100644 --- a/spa/plugins/audioconvert/channelmix.c +++ b/spa/plugins/audioconvert/channelmix.c @@ -252,7 +252,11 @@ static int setup_convert(struct impl *this, if ((res = channelmix_init(&this->mix)) < 0) return res; - this->props.n_channel_volumes = SPA_MAX(src_chan, dst_chan); + if (this->props.n_channel_volumes != this->mix.src_chan) { + this->props.n_channel_volumes = this->mix.src_chan; + for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) + this->props.channel_volumes[i] = 1.0; + } channelmix_set_volume(&this->mix, this->props.volume, this->props.mute, this->props.n_channel_volumes, this->props.channel_volumes);