From 8d14df5984382de0aea12ba5d8ef4eba22b9976e Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sun, 24 Mar 2024 20:42:32 -0700 Subject: Not sending proper voice server type down when breaking a connection --- indra/newview/llvoicewebrtc.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 6aab67ca63..a8bc468f4c 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2363,7 +2363,7 @@ void LLVoiceWebRTCConnection::breakVoiceConnection() LLSD body; body["logout"] = TRUE; body["viewer_session"] = mViewerSession; - body["voice_server_type"] = REPORTED_VOICE_SERVER_TYPE; + body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( new LLCoreHttpUtil::HttpCoroutineAdapter("LLVoiceWebRTCAdHocConnection::breakVoiceConnection", @@ -2419,9 +2419,7 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection() LLSD body; LLSD jsep; jsep["type"] = "offer"; - { - jsep["sdp"] = mChannelSDP; - } + jsep["sdp"] = mChannelSDP; body["jsep"] = jsep; if (mParcelLocalID != INVALID_PARCEL_ID) { -- cgit v1.2.3 From cdae5ebc168d95a304b9905de7b66381723e402f Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sat, 30 Mar 2024 21:58:00 -0700 Subject: Add UI for managing echo cancellation, AGC, and noise control. Plumb audio settings through from webrtc to the sound preferences UI (still needs some tweaking, of course.) Also, choose stun servers based on grid. Ultimately, the stun stun servers will be passed up via login or something. --- indra/newview/app_settings/settings.xml | 33 +++++++++++ indra/newview/llviewercontrol.cpp | 3 + indra/newview/llvoicevivox.cpp | 4 +- indra/newview/llvoicewebrtc.cpp | 35 ++++++++++- indra/newview/llvoicewebrtc.h | 2 +- .../default/xui/en/panel_preferences_sound.xml | 69 ++++++++++++++++++++-- 6 files changed, 137 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5f7d1d8a21..0de6db0d65 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -15108,6 +15108,39 @@ Value 44125 + VoiceEchoCancellation + + Comment + Voice Echo Cancellation + Persist + 1 + Type + Boolean + Value + 1 + + VoiceAutomaticGainControl + + Comment + Voice Automatic Gain Control + Persist + 1 + Type + Boolean + Value + 1 + + VoiceNoiseSuppressionLevel + + Comment + Voice Noise Suppression Level + Persist + 1 + Type + U32 + Value + 4 + WarningsAsChat Comment diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 7738cb904e..44173a8043 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -803,6 +803,9 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "PushToTalkButton", handleVoiceClientPrefsChanged); setting_setup_signal_listener(gSavedSettings, "PushToTalkToggle", handleVoiceClientPrefsChanged); setting_setup_signal_listener(gSavedSettings, "VoiceEarLocation", handleVoiceClientPrefsChanged); + setting_setup_signal_listener(gSavedSettings, "VoiceEchoCancellation", handleVoiceClientPrefsChanged); + setting_setup_signal_listener(gSavedSettings, "VoiceAutomaticGainControl", handleVoiceClientPrefsChanged); + setting_setup_signal_listener(gSavedSettings, "VoiceNoiseSuppressionLevel", handleVoiceClientPrefsChanged); setting_setup_signal_listener(gSavedSettings, "VoiceInputAudioDevice", handleVoiceClientPrefsChanged); setting_setup_signal_listener(gSavedSettings, "VoiceOutputAudioDevice", handleVoiceClientPrefsChanged); setting_setup_signal_listener(gSavedSettings, "AudioLevelMic", handleVoiceClientPrefsChanged); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 29aba8ecba..f5c9e3aa98 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -1154,7 +1154,9 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() do { LLVoiceVivoxStats::getInstance()->provisionAttemptStart(); - result = httpAdapter->postAndSuspend(httpRequest, url, LLSD(), httpOpts); + LLSD body; + body["voice_server_type"] = "vivox"; + result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); if (sShuttingDown) { diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index a8bc468f4c..bb5b386e7c 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -24,6 +24,7 @@ * $/LicenseInfo$ */ #include +#include #include "llvoicewebrtc.h" #include "llsdutil.h" @@ -279,7 +280,7 @@ void LLWebRTCVoiceClient::cleanUp() LL_DEBUGS("Voice") << "Exiting" << LL_ENDL; } -//--------------------------------------------------- +// -------------------------------------------------- const LLVoiceVersionInfo& LLWebRTCVoiceClient::getVersion() { @@ -299,6 +300,13 @@ void LLWebRTCVoiceClient::updateSettings() setRenderDevice(outputDevice); F32 mic_level = gSavedSettings.getF32("AudioLevelMic"); setMicGain(mic_level); + + llwebrtc::LLWebRTCDeviceInterface::AudioConfig config; + config.mEchoCancellation = gSavedSettings.getBOOL("VoiceEchoCancellation"); + config.mAGC = gSavedSettings.getBOOL("VoiceAutomaticGainControl"); + config.mNoiseSuppressionLevel = (llwebrtc::LLWebRTCDeviceInterface::AudioConfig::ENoiseSuppressionLevel)gSavedSettings.getU32("VoiceNoiseSuppressionLevel"); + mWebRTCDeviceInterface->setAudioConfig(config); + } // Observers @@ -2480,6 +2488,28 @@ void LLVoiceWebRTCConnection::OnVoiceConnectionRequestSuccess(const LLSD &result mWebRTCPeerConnectionInterface->AnswerAvailable(mRemoteChannelSDP); } +static llwebrtc::LLWebRTCPeerConnectionInterface::InitOptions getConnectionOptions() +{ + llwebrtc::LLWebRTCPeerConnectionInterface::InitOptions options; + llwebrtc::LLWebRTCPeerConnectionInterface::InitOptions::IceServers servers; + + // TODO: Pull these from login + std::string grid = LLGridManager::getInstance()->getGridLoginID(); + std::transform(grid.begin(), grid.end(), grid.begin(), [](unsigned char c){ return std::tolower(c); }); + int num_servers = 2; + if (grid == "agni") + { + num_servers = 3; + } + for (int i=1; i <= num_servers; i++) + { + servers.mUrls.push_back(llformat("stun:stun%d.%s.secondlife.io:3478", i, grid.c_str())); + } + options.mServers.push_back(servers); + return options; +} + + // Primary state machine for negotiating a single voice connection to the // Secondlife WebRTC server. bool LLVoiceWebRTCConnection::connectionStateMachine() @@ -2498,10 +2528,11 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() mTrickling = false; mIceCompleted = false; setVoiceConnectionState(VOICE_STATE_WAIT_FOR_SESSION_START); + // tell the webrtc library that we want a connection. The library will // respond with an offer on a separate thread, which will cause // the session state to change. - if (!mWebRTCPeerConnectionInterface->initializeConnection()) + if (!mWebRTCPeerConnectionInterface->initializeConnection(getConnectionOptions())) { setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); } diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 21fc79420b..96d39f3928 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -272,7 +272,7 @@ public: participantStatePtr_t findParticipantByID(const LLUUID& id); static ptr_t matchSessionByChannelID(const std::string& channel_id); - + void shutdownAllConnections(); void revive(); diff --git a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml index ab2e9c72f3..3dba5d060b 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml @@ -340,7 +340,7 @@ follows="left|top" top_delta="-6" layout="topleft" - left_pad="20" + left_pad="10" width="360" height="40" name="media_ear_location"> @@ -422,7 +422,7 @@ control_name="VoiceEarLocation" follows="left|top" layout="topleft" - left_pad="20" + left_pad="10" top_delta="-6" width="360" height="40" @@ -454,18 +454,38 @@ name="enable_lip_sync" top_pad="10" width="237"/> + + + + Noise Suppression + + + + + + + + Date: Sat, 30 Mar 2024 22:03:30 -0700 Subject: Renegotiate on remote description error --- indra/newview/llvoicewebrtc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 72d343598b..c196e16684 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2733,8 +2733,8 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b LLUUID agent_id(participant_id); if (agent_id.isNull()) { - LL_WARNS("Voice") << "Bad participant ID from data channel (" << participant_id << "):" << data << LL_ENDL; - continue; + // probably a test client. + continue; } LLWebRTCVoiceClient::participantStatePtr_t participant = -- cgit v1.2.3