From 6e7b0fc8823118127b3d182bbe13c43304f918b1 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Tue, 20 Apr 2021 15:52:00 -0700 Subject: SL-15072: First part of adding ability to disable the VIVOX auto VAD feature and set our own values via Debug Settings - hardcoded currently for testing but will be pulled from global settings eventually --- indra/newview/llvoicevivox.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++ indra/newview/llvoicevivox.h | 2 ++ 2 files changed, 67 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index a8d668420e..39d6868b5c 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -1883,6 +1883,13 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) notifyParticipantObservers(); notifyVoiceFontObservers(); + // disable the automatic VAD and explicitly set the VAD variables ourselves + // see SL-15072 for more details + unsigned int vad_hangover = 2001; + unsigned int vad_noise_floor = 577; + unsigned int vad_sensitivity = 44; + setupVADParams(vad_hangover, vad_noise_floor, vad_sensitivity); + LLSD timeoutEvent(LLSDMap("timeout", LLSD::Boolean(true))); mIsInChannel = true; @@ -3217,6 +3224,56 @@ void LLVivoxVoiceClient::sendLocalAudioUpdates() } } +/** + * Because of the recurring voice cutout issues (SL-15072) we are going to try + * to disable the automatic VAD (Voice Activity Detection) and set the associated + * parameters directly. We will expose them via Debug Settings and that should + * let us iterate on a collection of values that work for us. Hopefully! + * + * From the VIVOX Docs: + * + * vad_hangover: The 'Hangover time' - the time (in milliseconds) that it takes + * for the VAD to switch back to silence from speech mode after the last speech + * frame has been detected. + * + * vad_noise_floor: The 'vad noise floor' - A dimensionless value between 0 and + * 20000 (default 576) that controls the maximum level at which the noise floor + * may be set at by the VAD's noise tracking. Too low of a value will make noise + * tracking ineffective (A value of 0 disables noise tracking and the VAD then + * relies purely on the sensitivity property). Too high of a value will make + * long speech classifiable as noise. + * + * vad_sensitivity: The 'vad sensitivity' - A dimensionless value between 0 and + * 100, indicating the 'sensitivity of the VAD'. Increasing this value corresponds + * to decreasing the sensitivity of the VAD (i.e. '0' is most sensitive, + * while 100 is 'least sensitive') + */ +void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, + unsigned int vad_noise_floor, + unsigned int vad_sensitivity) +{ + std::ostringstream stream; + + // explicitly turn off the automatic VAD even though the + // default state is also disabled. + const unsigned int vad_auto_enabled = 0; + + // Create a request to set the VAD parameters: + LL_INFOS("Voice") << "Disabling the automatic VAD and setting the parameters explicitly." << LL_ENDL; + + stream << "" + << "" << vad_auto_enabled << "" + << "" << vad_hangover << "" + << "" << vad_hangover << "" + << "" << vad_hangover << "" + << "\n\n\n"; + + if (!stream.str().empty()) + { + writeString(stream.str()); + } +} + ///////////////////////////// // Response/Event handlers @@ -7569,6 +7626,14 @@ void LLVivoxProtocolParser::processResponse(std::string tag) { LLVivoxVoiceClient::getInstance()->accountGetTemplateFontsResponse(statusCode, statusString); } + else if (!stricmp(actionCstr, "Aux.SetVadProperties.1")) + { + std::cout << "@@@----" << std::endl; + std::cout << " Response for Aux.SetVadProperties.1 was" << std::endl; + std::cout << " statusCode: " << statusCode << std::endl; + std::cout << " statusString: " << statusString << std::endl; + std::cout << "----@@@" << std::endl; + } /* else if (!stricmp(actionCstr, "Account.ChannelGetList.1")) { diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 699c85066b..7985eae6e4 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -446,6 +446,8 @@ protected: // local audio updates, mic mute, speaker mute, mic volume and speaker volumes void sendLocalAudioUpdates(); + // disable auto-VAD and configure VAD parameters explicitly + void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity); ///////////////////////////// // Response/Event handlers -- cgit v1.2.3 From 28935a8b6435eaf41ab13605097257c9d7f5afda Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Tue, 20 Apr 2021 16:28:58 -0700 Subject: Move location where we call function to setup VAD but didn't help --- indra/newview/llvoicevivox.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 39d6868b5c..fa4504de62 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -683,7 +683,14 @@ void LLVivoxVoiceClient::voiceControlCoro() bool success = startAndConnectSession(); if (success) { - if (mTuningMode) + // disable the automatic VAD and explicitly set the VAD variables ourselves + // see SL-15072 for more details + unsigned int vad_hangover = 2001; + unsigned int vad_noise_floor = 577; + unsigned int vad_sensitivity = 44; + setupVADParams(vad_hangover, vad_noise_floor, vad_sensitivity); + + if (mTuningMode) { performMicTuning(); } @@ -1883,13 +1890,6 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) notifyParticipantObservers(); notifyVoiceFontObservers(); - // disable the automatic VAD and explicitly set the VAD variables ourselves - // see SL-15072 for more details - unsigned int vad_hangover = 2001; - unsigned int vad_noise_floor = 577; - unsigned int vad_sensitivity = 44; - setupVADParams(vad_hangover, vad_noise_floor, vad_sensitivity); - LLSD timeoutEvent(LLSDMap("timeout", LLSD::Boolean(true))); mIsInChannel = true; @@ -7628,11 +7628,13 @@ void LLVivoxProtocolParser::processResponse(std::string tag) } else if (!stricmp(actionCstr, "Aux.SetVadProperties.1")) { - std::cout << "@@@----" << std::endl; + // temporary for debugging- will eventually remove entirely or replace with a + // toast message to alert the user that it was set + std::cout << "@@@" << std::endl; std::cout << " Response for Aux.SetVadProperties.1 was" << std::endl; - std::cout << " statusCode: " << statusCode << std::endl; - std::cout << " statusString: " << statusString << std::endl; - std::cout << "----@@@" << std::endl; + std::cout << " statusCode: " << statusCode << std::endl; + std::cout << " statusString: " << statusString << std::endl; + std::cout << "@@@" << std::endl; } /* else if (!stricmp(actionCstr, "Account.ChannelGetList.1")) -- cgit v1.2.3 From 5ef055fe69d64917ba1b40856ab02fc20036dffc Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 21 Apr 2021 12:07:18 -0700 Subject: SL-15072 update. Values for VAD settings now stored in debug settings. Request successfully sent at startup and also, whenever a relevant debug setting is changed. Going to send this build to Brett to test --- indra/newview/app_settings/settings.xml | 38 +++++++++++++++++++++++++- indra/newview/llvoicevivox.cpp | 48 ++++++++++++++++++++++----------- indra/newview/llvoicevivox.h | 9 ++++--- 3 files changed, 75 insertions(+), 20 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 626a3d1ff3..bedf8a7bfe 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14425,7 +14425,43 @@ Value 44125 - VoiceCallsFriendsOnly + + + VivoxVadHangover + + Comment + The time (in milliseconds) that it takes or the VAD to switch back to silence from speech mode after the last speech frame has been detected + Persist + 1 + Type + U32 + Value + 2000 + + VivoxVadNoiseFloor + + Comment + A dimensionless value between 0 and 20000 (default 576) that controls the maximum level at which the noise floor may be set at by the VAD's noise tracking + Persist + 1 + Type + U32 + Value + 576 + + VivoxVadSensitivity + + Comment + + A dimensionless value between 0 and 100, indicating the 'sensitivity of the VAD'. Increasing this value corresponds to decreasing the sensitivity of the VAD + Persist + 1 + Type + U32 + Value + 40 + + VoiceCallsFriendsOnly Comment (Deprecated) Only accept voice calls from residents on your friends list diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index fa4504de62..f2115feb10 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -651,7 +651,6 @@ void LLVivoxVoiceClient::idle(void* user_data) { } - //========================================================================= // the following are methods to support the coroutine implementation of the // voice connection and processing. They should only be called in the context @@ -683,13 +682,18 @@ void LLVivoxVoiceClient::voiceControlCoro() bool success = startAndConnectSession(); if (success) { - // disable the automatic VAD and explicitly set the VAD variables ourselves - // see SL-15072 for more details - unsigned int vad_hangover = 2001; - unsigned int vad_noise_floor = 577; - unsigned int vad_sensitivity = 44; + // disable the automatic VAD and explicitly set the initial values of + // the VAD variables ourselves see SL-15072 for more details + unsigned int vad_hangover = gSavedSettings.getU32("VivoxVadHangover"); + unsigned int vad_noise_floor = gSavedSettings.getU32("VivoxVadNoiseFloor"); + unsigned int vad_sensitivity = gSavedSettings.getU32("VivoxVadSensitivity"); setupVADParams(vad_hangover, vad_noise_floor, vad_sensitivity); + // watch for changes to the VAD settings via Debug Settings UI and act on them accordingly + gSavedSettings.getControl("VivoxVadHangover")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); + gSavedSettings.getControl("VivoxVadNoiseFloor")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); + gSavedSettings.getControl("VivoxVadSensitivity")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); + if (mTuningMode) { performMicTuning(); @@ -737,7 +741,6 @@ void LLVivoxVoiceClient::voiceControlCoro() LL_INFOS("Voice") << "exiting" << LL_ENDL; } - bool LLVivoxVoiceClient::startAndConnectSession() { bool ok = false; @@ -3264,8 +3267,8 @@ void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, stream << "" << "" << vad_auto_enabled << "" << "" << vad_hangover << "" - << "" << vad_hangover << "" - << "" << vad_hangover << "" + << "" << vad_sensitivity << "" + << "" << vad_noise_floor << "" << "\n\n\n"; if (!stream.str().empty()) @@ -3274,6 +3277,17 @@ void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, } } +void LLVivoxVoiceClient::onVADSettingsChange() +{ + // pick up the VAD variables (one of which was changed) + unsigned int vad_hangover = gSavedSettings.getU32("VivoxVadHangover"); + unsigned int vad_noise_floor = gSavedSettings.getU32("VivoxVadNoiseFloor"); + unsigned int vad_sensitivity = gSavedSettings.getU32("VivoxVadSensitivity"); + + // build a VAD params change request and send it to SLVoice + setupVADParams(vad_hangover, vad_noise_floor, vad_sensitivity); +} + ///////////////////////////// // Response/Event handlers @@ -7628,13 +7642,15 @@ void LLVivoxProtocolParser::processResponse(std::string tag) } else if (!stricmp(actionCstr, "Aux.SetVadProperties.1")) { - // temporary for debugging- will eventually remove entirely or replace with a - // toast message to alert the user that it was set - std::cout << "@@@" << std::endl; - std::cout << " Response for Aux.SetVadProperties.1 was" << std::endl; - std::cout << " statusCode: " << statusCode << std::endl; - std::cout << " statusString: " << statusString << std::endl; - std::cout << "@@@" << std::endl; + // both values of statusCode (old and more recent) indicate valid requests + if (statusCode != 0 && statusCode != 200) + { + LL_WARNS("Voice") << "Aux.SetVadProperties.1 request failed: " + << "statusCode: " << statusCode + << " and " + << "statusString: " << statusString + << LL_ENDL; + } } /* else if (!stricmp(actionCstr, "Account.ChannelGetList.1")) diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 7985eae6e4..960030659d 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -446,9 +446,6 @@ protected: // local audio updates, mic mute, speaker mute, mic volume and speaker volumes void sendLocalAudioUpdates(); - // disable auto-VAD and configure VAD parameters explicitly - void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity); - ///////////////////////////// // Response/Event handlers void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID); @@ -474,6 +471,12 @@ protected: void muteListChanged(); + ///////////////////////////// + // VAD changes + // disable auto-VAD and configure VAD parameters explicitly + void setupVADParams(unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity); + void onVADSettingsChange(); + ///////////////////////////// // Sending updates of current state void updatePosition(void); -- cgit v1.2.3 From 0ccb0306da93fa279909f45131009e80687f2f3d Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Wed, 28 Apr 2021 11:41:53 -0700 Subject: After a small but successful test at our standup, we're going to make the default value for the VAD sensitivity 0 (off). The settings can all still be changed via Debug variables but this seems like a sensible starting point for the next test. --- indra/newview/app_settings/settings.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bedf8a7bfe..5d2a678e7e 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14453,13 +14453,13 @@ Comment - A dimensionless value between 0 and 100, indicating the 'sensitivity of the VAD'. Increasing this value corresponds to decreasing the sensitivity of the VAD + A dimensionless value between 0 and 100, indicating the 'sensitivity of the VAD'. Increasing this value corresponds to decreasing the sensitivity of the VAD and 0 is turned off altogether Persist 1 Type U32 Value - 40 + 0 VoiceCallsFriendsOnly -- cgit v1.2.3 From 0dd53d7b5b934ee4fdc312f26ec58530f5b45091 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 29 Apr 2021 15:59:19 -0700 Subject: Expose the flag to turn automatic VAD on and off. We will likely keep it off since that appears to be working well for us but others may want to turn in on --- indra/newview/app_settings/settings.xml | 12 +++++++++- indra/newview/llvoicevivox.cpp | 41 ++++++++++++++++++++------------- indra/newview/llvoicevivox.h | 2 +- 3 files changed, 37 insertions(+), 18 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 07f9511cf2..dcbbf64a97 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14426,7 +14426,17 @@ 44125 - + VivoxVadAuto + + Comment + A flag indicating if the automatic VAD is enabled (1) or disabled (0). The individual settings are ignored if the auto-mode is enabled + Persist + 1 + Type + U32 + Value + 0 + VivoxVadHangover Comment diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 96ae171eb7..0503ba3f94 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -683,14 +683,17 @@ void LLVivoxVoiceClient::voiceControlCoro() bool success = startAndConnectSession(); if (success) { - // disable the automatic VAD and explicitly set the initial values of - // the VAD variables ourselves see SL-15072 for more details + // enable/disable the automatic VAD and explicitly set the initial values of + // the VAD variables ourselves when it is off - see SL-15072 for more details + // note: we set the other parameters too even if the auto VAD is on which is ok + unsigned int vad_auto = gSavedSettings.getU32("VivoxVadAuto"); unsigned int vad_hangover = gSavedSettings.getU32("VivoxVadHangover"); unsigned int vad_noise_floor = gSavedSettings.getU32("VivoxVadNoiseFloor"); unsigned int vad_sensitivity = gSavedSettings.getU32("VivoxVadSensitivity"); - setupVADParams(vad_hangover, vad_noise_floor, vad_sensitivity); + setupVADParams(vad_auto, vad_hangover, vad_noise_floor, vad_sensitivity); // watch for changes to the VAD settings via Debug Settings UI and act on them accordingly + gSavedSettings.getControl("VivoxVadAuto")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); gSavedSettings.getControl("VivoxVadHangover")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); gSavedSettings.getControl("VivoxVadNoiseFloor")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); gSavedSettings.getControl("VivoxVadSensitivity")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); @@ -3248,37 +3251,42 @@ void LLVivoxVoiceClient::sendLocalAudioUpdates() * * From the VIVOX Docs: * - * vad_hangover: The 'Hangover time' - the time (in milliseconds) that it takes + * VadAuto: A flag indicating if the automatic VAD is enabled (1) or disabled (0) + * + * VadHangover: The time (in milliseconds) that it takes * for the VAD to switch back to silence from speech mode after the last speech * frame has been detected. * - * vad_noise_floor: The 'vad noise floor' - A dimensionless value between 0 and + * VadNoiseFloor: A dimensionless value between 0 and * 20000 (default 576) that controls the maximum level at which the noise floor * may be set at by the VAD's noise tracking. Too low of a value will make noise * tracking ineffective (A value of 0 disables noise tracking and the VAD then * relies purely on the sensitivity property). Too high of a value will make * long speech classifiable as noise. * - * vad_sensitivity: The 'vad sensitivity' - A dimensionless value between 0 and + * VadSensitivity: A dimensionless value between 0 and * 100, indicating the 'sensitivity of the VAD'. Increasing this value corresponds * to decreasing the sensitivity of the VAD (i.e. '0' is most sensitive, * while 100 is 'least sensitive') */ -void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, +void LLVivoxVoiceClient::setupVADParams(unsigned int vad_auto, + unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity) { std::ostringstream stream; - // explicitly turn off the automatic VAD even though the - // default state is also disabled. - const unsigned int vad_auto_enabled = 0; - - // Create a request to set the VAD parameters: - LL_INFOS("Voice") << "Disabling the automatic VAD and setting the parameters explicitly." << LL_ENDL; + LL_INFOS("Voice") << "Setting the automatic VAD to " + << (vad_auto ? "True" : "False") + << " and discrete values to" + << " VadHangover = " << vad_hangover + << ", VadSensitivity = " << vad_sensitivity + << ", VadNoiseFloor = " << vad_noise_floor + << LL_ENDL; - stream << "" - << "" << vad_auto_enabled << "" + // Create a request to set the VAD parameters: + stream << "" + << "" << vad_auto << "" << "" << vad_hangover << "" << "" << vad_sensitivity << "" << "" << vad_noise_floor << "" @@ -3293,12 +3301,13 @@ void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, void LLVivoxVoiceClient::onVADSettingsChange() { // pick up the VAD variables (one of which was changed) + unsigned int vad_auto = gSavedSettings.getU32("VivoxVadAuto"); unsigned int vad_hangover = gSavedSettings.getU32("VivoxVadHangover"); unsigned int vad_noise_floor = gSavedSettings.getU32("VivoxVadNoiseFloor"); unsigned int vad_sensitivity = gSavedSettings.getU32("VivoxVadSensitivity"); // build a VAD params change request and send it to SLVoice - setupVADParams(vad_hangover, vad_noise_floor, vad_sensitivity); + setupVADParams(vad_auto, vad_hangover, vad_noise_floor, vad_sensitivity); } ///////////////////////////// diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 960030659d..75ff5429f3 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -474,7 +474,7 @@ protected: ///////////////////////////// // VAD changes // disable auto-VAD and configure VAD parameters explicitly - void setupVADParams(unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity); + void setupVADParams(unsigned int vad_auto, unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity); void onVADSettingsChange(); ///////////////////////////// -- cgit v1.2.3