diff options
author | Callum Prentice <callum@lindenlab.com> | 2021-04-20 15:52:00 -0700 |
---|---|---|
committer | Callum Prentice <callum@lindenlab.com> | 2021-04-20 15:52:00 -0700 |
commit | 6e7b0fc8823118127b3d182bbe13c43304f918b1 (patch) | |
tree | ce22d8f912102a735191bc6961ca9ed194c724fc /indra | |
parent | 167e45e309ebeaccb346b8ca05884b8e10bf05eb (diff) |
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
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 65 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.h | 2 |
2 files changed, 67 insertions, 0 deletions
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 << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetVadProperties.1\">" + << "<VadAuto>" << vad_auto_enabled << "</VadAuto>" + << "<VadHangover>" << vad_hangover << "</VadHangover>" + << "<vad_noise_floor>" << vad_hangover << "</vad_noise_floor>" + << "<vad_sensitivity>" << vad_hangover << "</vad_sensitivity>" + << "</Request>\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 |