From 54befa491aa20252924a71e947a65320ee82ae5b Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 4 Oct 2021 14:08:05 +0200 Subject: [PATCH] Audio decoder: correctly handle volume changes 1. set the volume for all channels 2. correctly set attribute muted according to the value (until now it was actually never set) --- src/rtp/audio_decoders.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/rtp/audio_decoders.cpp b/src/rtp/audio_decoders.cpp index 37cc3083a..bb7d8c796 100644 --- a/src/rtp/audio_decoders.cpp +++ b/src/rtp/audio_decoders.cpp @@ -795,6 +795,11 @@ int decode_audio_frame_mulaw(struct coded_data *cdata, void *data, struct pbuf_s void audio_decoder_set_volume(void *state, double val) { auto s = (struct state_audio_decoder *) state; - s->scale->scale = val; + int output_channels = s->channel_remapping ? + s->channel_map.max_output + 1: s->saved_desc.ch_count; + for (int i = 0; i < output_channels; ++i) { + s->scale[i].scale = val; + } + s->muted = val == 0.0; }