From d8c73ebede3d1a24329bc133c6e3ab6af9008441 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 3 Oct 2023 12:59:17 +0200 Subject: [PATCH] module-raop-sink: don't let mute change the volume Use both the volume and mute to decide what volume to send. Don't let the mute state overwrite the volume. Also never mute the stream. Pressing mute and unmute restores the previous volume this way. --- src/modules/module-raop-sink.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/modules/module-raop-sink.c b/src/modules/module-raop-sink.c index 0046bb4c7..8eb028ecc 100644 --- a/src/modules/module-raop-sink.c +++ b/src/modules/module-raop-sink.c @@ -981,7 +981,7 @@ static int rtsp_send_volume(struct impl *impl) char header[128], volstr[64]; snprintf(header, sizeof(header), "volume: %s\r\n", - spa_dtoa(volstr, sizeof(volstr), impl->volume)); + spa_dtoa(volstr, sizeof(volstr), impl->mute ? VOLUME_MUTE : impl->volume)); return rtsp_send(impl, "SET_PARAMETER", "text/parameters", header, rtsp_log_reply_status); } @@ -1723,14 +1723,13 @@ static void stream_props_changed(struct impl *impl, uint32_t id, const struct sp { bool mute; if (spa_pod_get_bool(&prop->value, &mute) == 0) { - if (!impl->mute) { - impl->volume = VOLUME_MUTE; + if (!impl->mute != mute) { + impl->mute = mute; rtsp_send_volume(impl); } - impl->mute = mute; } spa_pod_builder_prop(&b, SPA_PROP_softMute, 0); - spa_pod_builder_bool(&b, impl->mute); + spa_pod_builder_bool(&b, false); spa_pod_builder_raw_padded(&b, prop, SPA_POD_PROP_SIZE(prop)); break; }