From 452107da4a2a4a34e4086ecb7e1bca0dc8571a01 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Tue, 16 Feb 2021 07:43:31 +0100 Subject: [PATCH] FIX(client): Default echo cancel setting not loaded correctly 613a5d5fb0ed4078e3a127b784eada14a809fa50 introuced a compatibility layer for porting over the old echo cancel settings to the new one. However by doing so it prevented the default setting (Speex mixed) from being loaded properly as in this case it is not saved explicitly. This would lead to the compat block being executed that would disable echo cancelling if there are no old settings. This commit fixes this by making sure the compat block is only run when the old setting is actually present. Fixes #4761 --- src/mumble/Settings.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index 67d850dc42c..1e6c4fb5730 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -780,20 +780,22 @@ void Settings::load(QSettings *settings_ptr) { // This block should only be called once at the first start of the new Mumble version // As echo cancellation was not available on macOS before, we don't have to run this compatibility // code on macOS (instead simply use the new default as set in the constructor). - bool deprecatedEcho = false; - bool deprecatedEchoMulti = false; + if (settings_ptr->contains("audio/echo")) { + bool deprecatedEcho = false; + bool deprecatedEchoMulti = false; - SAVELOAD(deprecatedEcho, "audio/echo"); - SAVELOAD(deprecatedEchoMulti, "audio/echomulti"); + SAVELOAD(deprecatedEcho, "audio/echo"); + SAVELOAD(deprecatedEchoMulti, "audio/echomulti"); - if (deprecatedEcho) { - if (deprecatedEchoMulti) { - echoOption = EchoCancelOptionID::SPEEX_MULTICHANNEL; + if (deprecatedEcho) { + if (deprecatedEchoMulti) { + echoOption = EchoCancelOptionID::SPEEX_MULTICHANNEL; + } else { + echoOption = EchoCancelOptionID::SPEEX_MIXED; + } } else { - echoOption = EchoCancelOptionID::SPEEX_MIXED; + echoOption = EchoCancelOptionID::DISABLED; } - } else { - echoOption = EchoCancelOptionID::DISABLED; } #endif } @@ -1013,6 +1015,8 @@ void Settings::load(QSettings *settings_ptr) { settings_ptr->beginGroup(QLatin1String("overlay")); os.load(settings_ptr); settings_ptr->endGroup(); + + qDebug() << "Echo option loaded to" << static_cast(echoOption); } #undef SAVELOAD