From 6b2844a61d659fc86e84988775677708c2a8c242 Mon Sep 17 00:00:00 2001 From: Georg Chini Date: Wed, 17 Feb 2021 21:36:07 +0100 Subject: [PATCH] source-output: Fix source-output volume after move of virtual source stream When the source-output of a virtual source with volume sharing disabled is moved, the source output volume is reset to 100%. This patch fixes the problem by applying the virtual source volume to the source-output after the move. Part-of: --- src/pulsecore/source-output.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index 92f74d4..248698a 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -1512,6 +1512,16 @@ static void update_volume_due_to_moving(pa_source_output *o, pa_source *dest) { pa_source_output_set_volume_direct(o, &o->reference_ratio); o->real_ratio = o->reference_ratio; pa_sw_cvolume_multiply(&o->soft_volume, &o->real_ratio, &o->volume_factor); + + /* If this is a virtual source stream, we have to apply the source volume + * to the source output. */ + if (o->destination_source) { + pa_cvolume vol; + + vol = o->destination_source->real_volume; + pa_cvolume_remap(&vol, &o->destination_source->channel_map, &o->channel_map); + pa_source_output_set_volume(o, &vol, o->destination_source->save_volume, true); + } } } -- 2.7.4