From 0ae8bbaf5d85b065354dcc010d08a4a2e759f867 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 6 Sep 2023 15:28:02 -0700 Subject: Checkpoint WebRTC Voice --- indra/newview/llvoiceclient.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 68d9f4ffab..294ae0c9ad 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -24,13 +24,13 @@ * $/LicenseInfo$ */ -#include "llviewerprecompiledheaders.h" #include "llvoiceclient.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" #include "llvoicevivox.h" +#include "llvoicewebrtc.h" #include "llviewernetwork.h" +#include "llviewercontrol.h" #include "llcommandhandler.h" +#include "lldir.h" #include "llhttpnode.h" #include "llnotificationsutil.h" #include "llsdserialize.h" @@ -161,6 +161,10 @@ void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &age { mVoiceModule = (LLVoiceModuleInterface *)LLVivoxVoiceClient::getInstance(); } + if (voice_server == "webrtc") + { + mVoiceModule = (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); + } else { mVoiceModule = NULL; -- cgit v1.2.3 From 0e6103e3a943c7f7726a93535048c634eb85eefc Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Thu, 25 Jan 2024 20:53:19 -0800 Subject: Checkpoint Ad-Hoc voice. Unlike vivox, P2P uses the ad-hoc voice mechanism, which is also used by group voice. --- indra/newview/llvoiceclient.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 294ae0c9ad..54840a1235 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -486,6 +486,13 @@ std::string LLVoiceClient::getCurrentChannel() //--------------------------------------- // invitations +bool LLVoiceClient::hasP2PInterface() +{ + if (mVoiceModule) + return mVoiceModule->hasP2PInterface(); + return false; +} + void LLVoiceClient::callUser(const LLUUID &uuid) { if (mVoiceModule) mVoiceModule->callUser(uuid); -- cgit v1.2.3 From 0cd8ad6ebb6e76bfc04cf6c423b0dc586161c6f7 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Thu, 1 Feb 2024 21:53:33 -0800 Subject: Hang up when peer hangs up in ad-hoc driven p2p call --- indra/newview/llvoiceclient.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 54840a1235..de7fb248b0 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -436,11 +436,12 @@ bool LLVoiceClient::inProximalChannel() void LLVoiceClient::setNonSpatialChannel( const std::string &uri, - const std::string &credentials) + const std::string &credentials, + bool hangup_on_last_leave) { if (mVoiceModule) { - mVoiceModule->setNonSpatialChannel(uri, credentials); + mVoiceModule->setNonSpatialChannel(uri, credentials, hangup_on_last_leave); } } -- cgit v1.2.3 From 7287cfbd7ad8f61114d0176c6fc7c3218c758900 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Thu, 22 Feb 2024 14:34:03 -0800 Subject: For spatial voice, determine voice provider based on server setting. --- indra/newview/llvoiceclient.cpp | 132 +++++++++++++++++++++++++++++----------- 1 file changed, 97 insertions(+), 35 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index de7fb248b0..3532d8e986 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -133,7 +133,6 @@ LLVoiceClient::LLVoiceClient(LLPumpIO *pump) mMuteMic(false), mDisableMic(false) { - updateSettings(); init(pump); } @@ -149,31 +148,71 @@ void LLVoiceClient::init(LLPumpIO *pump) { // Initialize all of the voice modules m_servicePump = pump; + LLWebRTCVoiceClient::getInstance()->init(pump); + LLVivoxVoiceClient::getInstance()->init(pump); } void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID) { - // In the future, we should change this to allow voice module registration - // with a table lookup of sorts. - std::string voice_server = gSavedSettings.getString("VoiceServerType"); - LL_DEBUGS("Voice") << "voice server type " << voice_server << LL_ENDL; - if(voice_server == "vivox") - { - mVoiceModule = (LLVoiceModuleInterface *)LLVivoxVoiceClient::getInstance(); - } - if (voice_server == "webrtc") + mUserID = user_id; + mAgentID = agentID; + gAgent.addRegionChangedCallback(boost::bind(&LLVoiceClient::onRegionChanged, this)); +} + +void LLVoiceClient::onRegionChanged() +{ + LLViewerRegion *region = gAgent.getRegion(); + if (region && region->simulatorFeaturesReceived()) + { + LLSD simulatorFeatures; + region->getSimulatorFeatures(simulatorFeatures); + setVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + } + else if (region) + { + if (mSimulatorFeaturesReceivedSlot.connected()) + { + mSimulatorFeaturesReceivedSlot.disconnect(); + } + mSimulatorFeaturesReceivedSlot = + region->setSimulatorFeaturesReceivedCallback( + boost::bind(&LLVoiceClient::onSimulatorFeaturesReceived, this, _1)); + } +} + +void LLVoiceClient::onSimulatorFeaturesReceived(const LLUUID& region_id) +{ + LLViewerRegion *region = gAgent.getRegion(); + if (region && (region->getRegionID() == region_id)) + { + LLSD simulatorFeatures; + region->getSimulatorFeatures(simulatorFeatures); + setVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + } +} + +void LLVoiceClient::setVoiceModule(const std::string& voice_server_type) +{ + if (voice_server_type == "vivox" || voice_server_type.empty()) + { + mVoiceModule = (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); + } + else if (voice_server_type == "webrtc") { mVoiceModule = (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); } else { - mVoiceModule = NULL; - return; + LLNotificationsUtil::add("VoiceVersionMismatch"); + mVoiceModule = nullptr; + return; } - mVoiceModule->init(m_servicePump); - mVoiceModule->userAuthorized(user_id, agentID); + mVoiceModule->userAuthorized(mUserID, mAgentID); + updateSettings(); } + + void LLVoiceClient::setHidden(bool hidden) { if (mVoiceModule) @@ -205,7 +244,7 @@ const LLVoiceVersionInfo LLVoiceClient::getVersion() { LLVoiceVersionInfo result; result.serverVersion = std::string(); - result.serverType = std::string(); + result.voiceServerType = std::string(); result.mBuildVersion = std::string(); return result; } @@ -864,31 +903,54 @@ LLVoiceEffectInterface* LLVoiceClient::getVoiceEffectInterface() const class LLViewerRequiredVoiceVersion : public LLHTTPNode { - static BOOL sAlertedUser; + static bool sAlertedUser; virtual void post( LLHTTPNode::ResponsePtr response, const LLSD& context, const LLSD& input) const { - //You received this messsage (most likely on region cross or - //teleport) - if ( input.has("body") && input["body"].has("major_version") ) + + + std::string voice_server_type = "vivox"; + if (input.has("body") && input["body"].has("voice_server_type")) { - int major_voice_version = - input["body"]["major_version"].asInteger(); - // int minor_voice_version = - // input["body"]["minor_version"].asInteger(); - LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); - - if (major_voice_version > 1) - { - if (!sAlertedUser) - { - //sAlertedUser = TRUE; - LLNotificationsUtil::add("VoiceVersionMismatch"); - gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener - } - } + voice_server_type = input["body"]["voice_server_type"].asString(); + } + + LLVoiceModuleInterface *voiceModule = NULL; + + if (voice_server_type == "vivox" || voice_server_type.empty()) + { + voiceModule = (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); + } + else if (voice_server_type == "webrtc") + { + voiceModule = (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); + } + else + { + LL_WARNS("Voice") << "Unknown voice server type " << voice_server_type << LL_ENDL; + if (!sAlertedUser) + { + // sAlertedUser = true; + LLNotificationsUtil::add("VoiceVersionMismatch"); + } + return; + } + + LLVoiceVersionInfo versionInfo = voiceModule->getVersion(); + if (input.has("body") && input["body"].has("major_version") && + input["body"]["major_version"].asInteger() > versionInfo.majorVersion) + { + if (!sAlertedUser) + { + // sAlertedUser = true; + LLNotificationsUtil::add("VoiceVersionMismatch"); + LL_WARNS("Voice") << "Voice server version mismatch " << input["body"]["major_version"].asInteger() << "/" + << versionInfo.majorVersion + << LL_ENDL; + } + return; } } }; @@ -1099,7 +1161,7 @@ void LLSpeakerVolumeStorage::save() } } -BOOL LLViewerRequiredVoiceVersion::sAlertedUser = FALSE; +bool LLViewerRequiredVoiceVersion::sAlertedUser = false; LLHTTPRegistration gHTTPRegistrationMessageParcelVoiceInfo( -- cgit v1.2.3 From 2117f8c4ba4565eef33f139a8c38b81f3c79648f Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sun, 3 Mar 2024 15:50:35 -0800 Subject: Refactor for vivox spatial and p2p General refactoring to improve vivox spacial and p2p voice including generalizing voice info instead of just using sip uri and credentials. Voice server type is also passed around in the generalized voice info blob. --- indra/newview/llvoiceclient.cpp | 521 ++++++++++++++++------------------------ 1 file changed, 211 insertions(+), 310 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 3532d8e986..3df94d8ba0 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -113,13 +113,28 @@ std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserv return result; } - +LLVoiceModuleInterface *getVoiceModule(const std::string &voice_server_type) +{ + if (voice_server_type == VIVOX_VOICE_SERVER_TYPE || voice_server_type.empty()) + { + return (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); + } + else if (voice_server_type == WEBRTC_VOICE_SERVER_TYPE) + { + return (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); + } + else + { + LLNotificationsUtil::add("VoiceVersionMismatch"); + return nullptr; + } +} /////////////////////////////////////////////////////////////////////////////////////////////// LLVoiceClient::LLVoiceClient(LLPumpIO *pump) : - mVoiceModule(NULL), + mSpatialVoiceModule(NULL), m_servicePump(NULL), mVoiceEffectEnabled(LLCachedControl(gSavedSettings, "VoiceMorphingEnabled", true)), mVoiceEffectDefault(LLCachedControl(gSavedPerAccountSettings, "VoiceEffectDefault", "00000000-0000-0000-0000-000000000000")), @@ -141,7 +156,7 @@ LLVoiceClient::LLVoiceClient(LLPumpIO *pump) LLVoiceClient::~LLVoiceClient() { - llassert(!mVoiceModule); + llassert(!mSpatialVoiceModule); } void LLVoiceClient::init(LLPumpIO *pump) @@ -154,9 +169,9 @@ void LLVoiceClient::init(LLPumpIO *pump) void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID) { - mUserID = user_id; - mAgentID = agentID; gAgent.addRegionChangedCallback(boost::bind(&LLVoiceClient::onRegionChanged, this)); + LLWebRTCVoiceClient::getInstance()->userAuthorized(user_id, agentID); + LLVivoxVoiceClient::getInstance()->userAuthorized(user_id, agentID); } void LLVoiceClient::onRegionChanged() @@ -166,7 +181,7 @@ void LLVoiceClient::onRegionChanged() { LLSD simulatorFeatures; region->getSimulatorFeatures(simulatorFeatures); - setVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); } else if (region) { @@ -187,44 +202,57 @@ void LLVoiceClient::onSimulatorFeaturesReceived(const LLUUID& region_id) { LLSD simulatorFeatures; region->getSimulatorFeatures(simulatorFeatures); - setVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); } } -void LLVoiceClient::setVoiceModule(const std::string& voice_server_type) +void LLVoiceClient::setSpatialVoiceModule(const std::string &voice_server_type) { - if (voice_server_type == "vivox" || voice_server_type.empty()) - { - mVoiceModule = (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); - } - else if (voice_server_type == "webrtc") - { - mVoiceModule = (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); - } - else + LLVoiceModuleInterface *module = getVoiceModule(voice_server_type); + if (!module) { - LLNotificationsUtil::add("VoiceVersionMismatch"); - mVoiceModule = nullptr; return; } - mVoiceModule->userAuthorized(mUserID, mAgentID); - updateSettings(); + if (module != mSpatialVoiceModule) + { + if (inProximalChannel()) + { + mSpatialVoiceModule->processChannels(false); + } + module->processChannels(true); + mSpatialVoiceModule = module; + mSpatialVoiceModule->updateSettings(); + } } - +void LLVoiceClient::setNonSpatialVoiceModule(const std::string &voice_server_type) +{ + mNonSpatialVoiceModule = getVoiceModule(voice_server_type); + if (!mNonSpatialVoiceModule) + { + // we don't have a non-spatial voice module, + // so revert to spatial. + if (mSpatialVoiceModule) + { + mSpatialVoiceModule->processChannels(true); + } + return; + } + mNonSpatialVoiceModule->updateSettings(); +} void LLVoiceClient::setHidden(bool hidden) { - if (mVoiceModule) + if (mSpatialVoiceModule) { - mVoiceModule->setHidden(hidden); + mSpatialVoiceModule->setHidden(hidden); } } void LLVoiceClient::terminate() { - if (mVoiceModule) mVoiceModule->terminate(); - mVoiceModule = NULL; + if (mSpatialVoiceModule) mSpatialVoiceModule->terminate(); + mSpatialVoiceModule = NULL; m_servicePump = NULL; // Shutdown speaker volume storage before LLSingletonBase::deleteAll() does it @@ -236,9 +264,9 @@ void LLVoiceClient::terminate() const LLVoiceVersionInfo LLVoiceClient::getVersion() { - if (mVoiceModule) + if (mSpatialVoiceModule) { - return mVoiceModule->getVersion(); + return mSpatialVoiceModule->getVersion(); } else { @@ -258,10 +286,8 @@ void LLVoiceClient::updateSettings() updateMicMuteLogic(); - if (mVoiceModule) - { - mVoiceModule->updateSettings(); - } + LLWebRTCVoiceClient::getInstance()->updateSettings(); + LLVivoxVoiceClient::getInstance()->updateSettings(); } //-------------------------------------------------- @@ -269,117 +295,76 @@ void LLVoiceClient::updateSettings() void LLVoiceClient::tuningStart() { - if (mVoiceModule) mVoiceModule->tuningStart(); + LLWebRTCVoiceClient::getInstance()->tuningStart(); + LLVivoxVoiceClient::getInstance()->tuningStart(); } void LLVoiceClient::tuningStop() { - if (mVoiceModule) mVoiceModule->tuningStop(); + LLWebRTCVoiceClient::getInstance()->tuningStop(); + LLVivoxVoiceClient::getInstance()->tuningStop(); + } bool LLVoiceClient::inTuningMode() { - if (mVoiceModule) - { - return mVoiceModule->inTuningMode(); - } - else - { - return false; - } + return LLWebRTCVoiceClient::getInstance()->inTuningMode(); } void LLVoiceClient::tuningSetMicVolume(float volume) { - if (mVoiceModule) mVoiceModule->tuningSetMicVolume(volume); + LLWebRTCVoiceClient::getInstance()->tuningSetMicVolume(volume); } void LLVoiceClient::tuningSetSpeakerVolume(float volume) { - if (mVoiceModule) mVoiceModule->tuningSetSpeakerVolume(volume); + LLWebRTCVoiceClient::getInstance()->tuningSetSpeakerVolume(volume); } float LLVoiceClient::tuningGetEnergy(void) { - if (mVoiceModule) - { - return mVoiceModule->tuningGetEnergy(); - } - else - { - return 0.0; - } + return LLWebRTCVoiceClient::getInstance()->tuningGetEnergy(); } - //------------------------------------------------ // devices bool LLVoiceClient::deviceSettingsAvailable() -{ - if (mVoiceModule) - { - return mVoiceModule->deviceSettingsAvailable(); - } - else - { - return false; - } +{ + return LLWebRTCVoiceClient::getInstance()->deviceSettingsAvailable(); } bool LLVoiceClient::deviceSettingsUpdated() -{ - if (mVoiceModule) - { - return mVoiceModule->deviceSettingsUpdated(); - } - else - { - return false; - } +{ + return LLWebRTCVoiceClient::getInstance()->deviceSettingsUpdated(); } void LLVoiceClient::refreshDeviceLists(bool clearCurrentList) { - if (mVoiceModule) mVoiceModule->refreshDeviceLists(clearCurrentList); + LLWebRTCVoiceClient::getInstance()->refreshDeviceLists(clearCurrentList); } void LLVoiceClient::setCaptureDevice(const std::string& name) { - if (mVoiceModule) mVoiceModule->setCaptureDevice(name); - + LLWebRTCVoiceClient::getInstance()->setCaptureDevice(name); + LLVivoxVoiceClient::getInstance()->setCaptureDevice(name); } void LLVoiceClient::setRenderDevice(const std::string& name) { - if (mVoiceModule) mVoiceModule->setRenderDevice(name); + LLWebRTCVoiceClient::getInstance()->setRenderDevice(name); + LLVivoxVoiceClient::getInstance()->setRenderDevice(name); } const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices() { - static LLVoiceDeviceList nullCaptureDevices; - if (mVoiceModule) - { - return mVoiceModule->getCaptureDevices(); - } - else - { - return nullCaptureDevices; - } + return LLWebRTCVoiceClient::getInstance()->getCaptureDevices(); } const LLVoiceDeviceList& LLVoiceClient::getRenderDevices() -{ - static LLVoiceDeviceList nullRenderDevices; - if (mVoiceModule) - { - return mVoiceModule->getRenderDevices(); - } - else - { - return nullRenderDevices; - } +{ + return LLWebRTCVoiceClient::getInstance()->getRenderDevices(); } @@ -388,84 +373,51 @@ const LLVoiceDeviceList& LLVoiceClient::getRenderDevices() void LLVoiceClient::getParticipantList(std::set &participants) { - if (mVoiceModule) - { - mVoiceModule->getParticipantList(participants); - } - else - { - participants = std::set(); - } + LLWebRTCVoiceClient::getInstance()->getParticipantList(participants); + LLVivoxVoiceClient::getInstance()->getParticipantList(participants); } bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) { - if(mVoiceModule) - { - return mVoiceModule->isParticipant(speaker_id); - } - return false; + return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) || LLVivoxVoiceClient::getInstance()->isParticipant(speaker_id); } //-------------------------------------------------- // text chat - BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id) { - if (mVoiceModule) + if (mSpatialVoiceModule) { - return mVoiceModule->isSessionTextIMPossible(id); + return mSpatialVoiceModule->isSessionTextIMPossible(id); } else { return FALSE; - } -} - -BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id) -{ - if (mVoiceModule) - { - return mVoiceModule->isSessionCallBackPossible(id); } - else - { - return FALSE; - } } -/* obsolete -BOOL LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message) +BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id) { - if (mVoiceModule) + if (mSpatialVoiceModule) { - return mVoiceModule->sendTextMessage(participant_id, message); + return mSpatialVoiceModule->isSessionCallBackPossible(id); } else { return FALSE; } } -*/ - -void LLVoiceClient::endUserIMSession(const LLUUID& participant_id) -{ - if (mVoiceModule) - { - // mVoiceModule->endUserIMSession(participant_id); // A SLim leftover - } -} //---------------------------------------------- // channels bool LLVoiceClient::inProximalChannel() { - if (mVoiceModule) + if (mSpatialVoiceModule) { - return mVoiceModule->inProximalChannel(); + return mSpatialVoiceModule->inProximalChannel(); } else { @@ -474,112 +426,111 @@ bool LLVoiceClient::inProximalChannel() } void LLVoiceClient::setNonSpatialChannel( - const std::string &uri, - const std::string &credentials, + const LLSD& channelInfo, bool hangup_on_last_leave) { - if (mVoiceModule) + setNonSpatialVoiceModule(channelInfo["voice_server_type"].asString()); + if (mSpatialVoiceModule) { - mVoiceModule->setNonSpatialChannel(uri, credentials, hangup_on_last_leave); + mSpatialVoiceModule->processChannels(false); } + if (mNonSpatialVoiceModule) + { + mNonSpatialVoiceModule->setNonSpatialChannel(channelInfo, hangup_on_last_leave); + mNonSpatialVoiceModule->processChannels(true); + } } -void LLVoiceClient::setSpatialChannel( - const std::string &uri, - const std::string &credentials) +void LLVoiceClient::setSpatialChannel(const LLSD &channelInfo) { - if (mVoiceModule) + LLViewerRegion *region = gAgent.getRegion(); + if (region && region->simulatorFeaturesReceived()) { - mVoiceModule->setSpatialChannel(uri, credentials); + LLSD simulatorFeatures; + region->getSimulatorFeatures(simulatorFeatures); + setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); } -} - -void LLVoiceClient::leaveNonSpatialChannel() -{ - if (mVoiceModule) + if (mNonSpatialVoiceModule) { - mVoiceModule->leaveNonSpatialChannel(); + mNonSpatialVoiceModule->leaveNonSpatialChannel(); + mNonSpatialVoiceModule->processChannels(false); + mNonSpatialVoiceModule = nullptr; } -} - -void LLVoiceClient::leaveChannel(void) -{ - if (mVoiceModule) + if (mSpatialVoiceModule) { - mVoiceModule->leaveChannel(); + mSpatialVoiceModule->setSpatialChannel(channelInfo); + mSpatialVoiceModule->processChannels(true); } } -std::string LLVoiceClient::getCurrentChannel() +void LLVoiceClient::leaveNonSpatialChannel() { - if (mVoiceModule) - { - return mVoiceModule->getCurrentChannel(); - } - else + if (mNonSpatialVoiceModule) + { + mNonSpatialVoiceModule->leaveNonSpatialChannel(); + mNonSpatialVoiceModule->processChannels(false); + mNonSpatialVoiceModule = nullptr; + } + if (mSpatialVoiceModule) { - return std::string(); + mSpatialVoiceModule->processChannels(true); + ; } } - -//--------------------------------------- -// invitations - -bool LLVoiceClient::hasP2PInterface() +void LLVoiceClient::activateSpatialChannel(bool activate) { - if (mVoiceModule) - return mVoiceModule->hasP2PInterface(); - return false; + if (mSpatialVoiceModule) + { + mSpatialVoiceModule->processChannels(activate); + } } -void LLVoiceClient::callUser(const LLUUID &uuid) +bool LLVoiceClient::isCurrentChannel(const LLSD& channelInfo) { - if (mVoiceModule) mVoiceModule->callUser(uuid); + return LLWebRTCVoiceClient::getInstance()->isCurrentChannel(channelInfo) || + LLVivoxVoiceClient::getInstance()->isCurrentChannel(channelInfo); } -bool LLVoiceClient::isValidChannel(std::string &session_handle) +bool LLVoiceClient::compareChannels(const LLSD &channelInfo1, const LLSD &channelInfo2) { - if (mVoiceModule) - { - return mVoiceModule->isValidChannel(session_handle); - } - else - { - return false; - } + return LLWebRTCVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2) || + LLVivoxVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2); } -bool LLVoiceClient::answerInvite(std::string &channelHandle) +LLVoiceP2PIncomingCallInterfacePtr LLVoiceClient::getIncomingCallInterface(const LLSD& voice_call_info) { - if (mVoiceModule) - { - return mVoiceModule->answerInvite(channelHandle); - } - else + LLVoiceModuleInterface *module = getVoiceModule(voice_call_info["voice_server_type"]); + if (module) { - return false; + return module->getIncomingCallInterface(voice_call_info); } + return nullptr; + } -void LLVoiceClient::declineInvite(std::string &channelHandle) +//--------------------------------------- +// outgoing calls +LLVoiceP2POutgoingCallInterface *LLVoiceClient::getOutgoingCallInterface(const LLSD& voiceChannelInfo) { - if (mVoiceModule) mVoiceModule->declineInvite(channelHandle); + LLVoiceModuleInterface *module = getVoiceModule(voiceChannelInfo["voice_server_type"].asString()); + return dynamic_cast(module); } - //------------------------------------------ // Volume/gain void LLVoiceClient::setVoiceVolume(F32 volume) { - if (mVoiceModule) mVoiceModule->setVoiceVolume(volume); + LLWebRTCVoiceClient::getInstance()->setVoiceVolume(volume); + LLVivoxVoiceClient::getInstance()->setVoiceVolume(volume); } -void LLVoiceClient::setMicGain(F32 volume) +void LLVoiceClient::setMicGain(F32 gain) { - if (mVoiceModule) mVoiceModule->setMicGain(volume); + LLWebRTCVoiceClient::getInstance()->setMicGain(gain); + LLVivoxVoiceClient::getInstance()->setMicGain(gain); } @@ -588,22 +539,13 @@ void LLVoiceClient::setMicGain(F32 volume) bool LLVoiceClient::voiceEnabled() { - if (mVoiceModule) - { - return mVoiceModule->voiceEnabled(); - } - else - { - return false; - } + return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice") && !gNonInteractive; } void LLVoiceClient::setVoiceEnabled(bool enabled) { - if (mVoiceModule) - { - mVoiceModule->setVoiceEnabled(enabled); - } + LLWebRTCVoiceClient::getInstance()->setVoiceEnabled(enabled); + LLVivoxVoiceClient::getInstance()->setVoiceEnabled(enabled); } void LLVoiceClient::updateMicMuteLogic() @@ -622,25 +564,8 @@ void LLVoiceClient::updateMicMuteLogic() // Either of these always overrides any other PTT setting. new_mic_mute = true; } - - if (mVoiceModule) mVoiceModule->setMuteMic(new_mic_mute); -} - -void LLVoiceClient::setLipSyncEnabled(BOOL enabled) -{ - if (mVoiceModule) mVoiceModule->setLipSyncEnabled(enabled); -} - -BOOL LLVoiceClient::lipSyncEnabled() -{ - if (mVoiceModule) - { - return mVoiceModule->lipSyncEnabled(); - } - else - { - return false; - } + LLWebRTCVoiceClient::getInstance()->setMuteMic(new_mic_mute); + LLVivoxVoiceClient::getInstance()->setMuteMic(new_mic_mute); } void LLVoiceClient::setMuteMic(bool muted) @@ -726,9 +651,13 @@ void LLVoiceClient::toggleUserPTTState(void) BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id) { - if (mVoiceModule) + if (mNonSpatialVoiceModule) + { + return mNonSpatialVoiceModule->getVoiceEnabled(id); + } + else if (mSpatialVoiceModule) { - return mVoiceModule->getVoiceEnabled(id); + return mSpatialVoiceModule->getVoiceEnabled(id); } else { @@ -738,9 +667,13 @@ BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id) std::string LLVoiceClient::getDisplayName(const LLUUID& id) { - if (mVoiceModule) + if (mNonSpatialVoiceModule) + { + return mNonSpatialVoiceModule->getDisplayName(id); + } + else if (mSpatialVoiceModule) { - return mVoiceModule->getDisplayName(id); + return mSpatialVoiceModule->getDisplayName(id); } else { @@ -750,47 +683,35 @@ std::string LLVoiceClient::getDisplayName(const LLUUID& id) bool LLVoiceClient::isVoiceWorking() const { - if (mVoiceModule) - { - return mVoiceModule->isVoiceWorking(); - } - return false; + return LLVivoxVoiceClient::getInstance()->isVoiceWorking() || LLWebRTCVoiceClient::getInstance()->isVoiceWorking(); } BOOL LLVoiceClient::isParticipantAvatar(const LLUUID& id) { - if (mVoiceModule) - { - return mVoiceModule->isParticipantAvatar(id); - } - else - { - return FALSE; - } + return TRUE; } BOOL LLVoiceClient::isOnlineSIP(const LLUUID& id) { - return FALSE; + return FALSE; } BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id) { - if (mVoiceModule) - { - return mVoiceModule->getIsSpeaking(id); - } - else - { - return FALSE; - } + return LLVivoxVoiceClient::getInstance()->getIsSpeaking(id) || LLWebRTCVoiceClient::getInstance()->getIsSpeaking(id); } BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id) { - if (mVoiceModule) + // don't bother worrying about p2p calls, as + // p2p calls don't have mute. + if (mNonSpatialVoiceModule) + { + return mNonSpatialVoiceModule->getIsModeratorMuted(id); + } + else if (mSpatialVoiceModule) { - return mVoiceModule->getIsModeratorMuted(id); + return mSpatialVoiceModule->getIsModeratorMuted(id); } else { @@ -799,22 +720,21 @@ BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id) } F32 LLVoiceClient::getCurrentPower(const LLUUID& id) -{ - if (mVoiceModule) - { - return mVoiceModule->getCurrentPower(id); - } - else - { - return 0.0; - } +{ + return std::fmax(LLVivoxVoiceClient::getInstance()->getCurrentPower(id), LLWebRTCVoiceClient::getInstance()->getCurrentPower(id)); } BOOL LLVoiceClient::getOnMuteList(const LLUUID& id) { - if (mVoiceModule) + // don't bother worrying about p2p calls, as + // p2p calls don't have mute. + if (mNonSpatialVoiceModule) + { + return mNonSpatialVoiceModule->getOnMuteList(id); + } + else if (mSpatialVoiceModule) { - return mVoiceModule->getOnMuteList(id); + return mSpatialVoiceModule->getOnMuteList(id); } else { @@ -824,19 +744,13 @@ BOOL LLVoiceClient::getOnMuteList(const LLUUID& id) F32 LLVoiceClient::getUserVolume(const LLUUID& id) { - if (mVoiceModule) - { - return mVoiceModule->getUserVolume(id); - } - else - { - return 0.0; - } + return std::fmax(LLVivoxVoiceClient::getInstance()->getUserVolume(id), LLWebRTCVoiceClient::getInstance()->getUserVolume(id)); } void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume) { - if (mVoiceModule) mVoiceModule->setUserVolume(id, volume); + LLWebRTCVoiceClient::getInstance()->setUserVolume(id, volume); + LLVivoxVoiceClient::getInstance()->setUserVolume(id, volume); } //-------------------------------------------------- @@ -844,48 +758,49 @@ void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume) void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer) { - if (mVoiceModule) mVoiceModule->addObserver(observer); + LLVivoxVoiceClient::getInstance()->addObserver(observer); + LLWebRTCVoiceClient::getInstance()->addObserver(observer); } void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer) { - if (mVoiceModule) - { - mVoiceModule->removeObserver(observer); - } + LLVivoxVoiceClient::getInstance()->removeObserver(observer); + LLWebRTCVoiceClient::getInstance()->removeObserver(observer); } void LLVoiceClient::addObserver(LLFriendObserver* observer) { - if (mVoiceModule) mVoiceModule->addObserver(observer); + LLVivoxVoiceClient::getInstance()->addObserver(observer); + LLWebRTCVoiceClient::getInstance()->addObserver(observer); } void LLVoiceClient::removeObserver(LLFriendObserver* observer) { - if (mVoiceModule) - { - mVoiceModule->removeObserver(observer); - } + LLVivoxVoiceClient::getInstance()->removeObserver(observer); + LLWebRTCVoiceClient::getInstance()->removeObserver(observer); } void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer) { - if (mVoiceModule) mVoiceModule->addObserver(observer); + LLVivoxVoiceClient::getInstance()->addObserver(observer); + LLWebRTCVoiceClient::getInstance()->addObserver(observer); } void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer) { - if (mVoiceModule) - { - mVoiceModule->removeObserver(observer); - } + LLVivoxVoiceClient::getInstance()->removeObserver(observer); + LLWebRTCVoiceClient::getInstance()->removeObserver(observer); } std::string LLVoiceClient::sipURIFromID(const LLUUID &id) { - if (mVoiceModule) + if (mNonSpatialVoiceModule) { - return mVoiceModule->sipURIFromID(id); + return mNonSpatialVoiceModule->sipURIFromID(id); + } + else if (mSpatialVoiceModule) + { + return mSpatialVoiceModule->sipURIFromID(id); } else { @@ -895,7 +810,7 @@ std::string LLVoiceClient::sipURIFromID(const LLUUID &id) LLVoiceEffectInterface* LLVoiceClient::getVoiceEffectInterface() const { - return getVoiceEffectEnabled() ? dynamic_cast(mVoiceModule) : NULL; + return getVoiceEffectEnabled() ? dynamic_cast(mSpatialVoiceModule) : NULL; } /////////////////// @@ -983,22 +898,8 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode //local parcel id to make sure it's for the same parcel //we believe we're in if ( body.has("voice_credentials") ) - { - LLSD voice_credentials = body["voice_credentials"]; - std::string uri; - std::string credentials; - - if ( voice_credentials.has("channel_uri") ) - { - uri = voice_credentials["channel_uri"].asString(); - } - if ( voice_credentials.has("channel_credentials") ) - { - credentials = - voice_credentials["channel_credentials"].asString(); - } - - LLVoiceClient::getInstance()->setSpatialChannel(uri, credentials); + { + LLVoiceClient::getInstance()->setSpatialChannel(body["voice_credentials"]); } } } -- cgit v1.2.3 From b17c668d1257ba66e6a0bf84d0ad4c0da785ad64 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sun, 3 Mar 2024 22:34:35 -0800 Subject: fix webrtc logic bugs and such --- indra/newview/llvoiceclient.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 3df94d8ba0..087c93a3f5 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -513,7 +513,12 @@ LLVoiceP2PIncomingCallInterfacePtr LLVoiceClient::getIncomingCallInterface(const // outgoing calls LLVoiceP2POutgoingCallInterface *LLVoiceClient::getOutgoingCallInterface(const LLSD& voiceChannelInfo) { - LLVoiceModuleInterface *module = getVoiceModule(voiceChannelInfo["voice_server_type"].asString()); + std::string voiceServerType = gSavedSettings.getString("VoiceServerType"); + if (voiceChannelInfo.has("voice_server_type")) + { + voiceServerType = voiceChannelInfo["voice_server_type"].asString(); + } + LLVoiceModuleInterface *module = getVoiceModule(voiceServerType); return dynamic_cast(module); } -- cgit v1.2.3 From 6d5304bd921d765dfa7e1ab6d5d0e0b64dea11f1 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Tue, 5 Mar 2024 11:05:31 -0800 Subject: For webrtc, 'calling' dialog should remain up, disappearing when peer connects (p2p) --- indra/newview/llvoiceclient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 087c93a3f5..b642c43f34 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -427,6 +427,7 @@ bool LLVoiceClient::inProximalChannel() void LLVoiceClient::setNonSpatialChannel( const LLSD& channelInfo, + bool notify_on_first_join, bool hangup_on_last_leave) { setNonSpatialVoiceModule(channelInfo["voice_server_type"].asString()); @@ -436,7 +437,7 @@ void LLVoiceClient::setNonSpatialChannel( } if (mNonSpatialVoiceModule) { - mNonSpatialVoiceModule->setNonSpatialChannel(channelInfo, hangup_on_last_leave); + mNonSpatialVoiceModule->setNonSpatialChannel(channelInfo, notify_on_first_join, hangup_on_last_leave); mNonSpatialVoiceModule->processChannels(true); } } -- cgit v1.2.3 From 42c7a335f840acf1b927b1ed6c8e06a6f00534d0 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Thu, 7 Mar 2024 23:13:11 -0800 Subject: Fix issue with spatial and p2p being up at the same time Also, fix issue with voice still happening in parcels where voice is disabled. --- indra/newview/llvoiceclient.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index b642c43f34..9f99549829 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -400,14 +400,8 @@ BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id) BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id) { - if (mSpatialVoiceModule) - { - return mSpatialVoiceModule->isSessionCallBackPossible(id); - } - else - { - return FALSE; - } + // we don't support PSTN calls anymore. (did we ever?) + return TRUE; } //---------------------------------------------- -- cgit v1.2.3 From fc462b2b0f7ee153626d162bd97a05110f0804b7 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sun, 10 Mar 2024 00:11:43 -0800 Subject: Remove trailing spaces. Other code cleanup. --- indra/newview/llvoiceclient.cpp | 138 ++++++++++++++-------------------------- 1 file changed, 49 insertions(+), 89 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 9f99549829..33e76c14ae 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -1,25 +1,25 @@ - /** + /** * @file llvoiceclient.cpp * @brief Voice client delegation class implementation. * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -81,10 +81,10 @@ LLVoiceHandler gVoiceHandler; std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus) { std::string result = "UNTRANSLATED"; - + // Prevent copy-paste errors when updating this list... #define CASE(x) case x: result = #x; break - + switch(inStatus) { CASE(STATUS_LOGIN_RETRY); @@ -107,9 +107,9 @@ std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserv } break; } - + #undef CASE - + return result; } @@ -209,7 +209,7 @@ void LLVoiceClient::onSimulatorFeaturesReceived(const LLUUID& region_id) void LLVoiceClient::setSpatialVoiceModule(const std::string &voice_server_type) { LLVoiceModuleInterface *module = getVoiceModule(voice_server_type); - if (!module) + if (!module) { return; } @@ -264,7 +264,7 @@ void LLVoiceClient::terminate() const LLVoiceVersionInfo LLVoiceClient::getVersion() { - if (mSpatialVoiceModule) + if (mSpatialVoiceModule) { return mSpatialVoiceModule->getVersion(); } @@ -330,12 +330,12 @@ float LLVoiceClient::tuningGetEnergy(void) // devices bool LLVoiceClient::deviceSettingsAvailable() -{ +{ return LLWebRTCVoiceClient::getInstance()->deviceSettingsAvailable(); } bool LLVoiceClient::deviceSettingsUpdated() -{ +{ return LLWebRTCVoiceClient::getInstance()->deviceSettingsUpdated(); } @@ -363,7 +363,7 @@ const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices() const LLVoiceDeviceList& LLVoiceClient::getRenderDevices() -{ +{ return LLWebRTCVoiceClient::getInstance()->getRenderDevices(); } @@ -379,7 +379,8 @@ void LLVoiceClient::getParticipantList(std::set &participants) bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) { - return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) || LLVivoxVoiceClient::getInstance()->isParticipant(speaker_id); + return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) || + LLVivoxVoiceClient::getInstance()->isParticipant(speaker_id); } @@ -388,14 +389,8 @@ bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id) { - if (mSpatialVoiceModule) - { - return mSpatialVoiceModule->isSessionTextIMPossible(id); - } - else - { - return FALSE; - } + // all sessions can do TextIM, as we no longer support PSTN + return TRUE; } BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id) @@ -409,7 +404,7 @@ BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id) bool LLVoiceClient::inProximalChannel() { - if (mSpatialVoiceModule) + if (mSpatialVoiceModule) { return mSpatialVoiceModule->inProximalChannel(); } @@ -552,7 +547,7 @@ void LLVoiceClient::updateMicMuteLogic() { // If not configured to use PTT, the mic should be open (otherwise the user will be unable to speak). bool new_mic_mute = false; - + if(mUsePTT) { // If configured to use PTT, track the user state. @@ -603,7 +598,7 @@ void LLVoiceClient::setUsePTT(bool usePTT) mUserPTTState = false; } mUsePTT = usePTT; - + updateMicMuteLogic(); } @@ -614,7 +609,7 @@ void LLVoiceClient::setPTTIsToggle(bool PTTIsToggle) // When the user turns off toggle, reset the current state. mUserPTTState = false; } - + mPTTIsToggle = PTTIsToggle; updateMicMuteLogic(); @@ -629,12 +624,12 @@ void LLVoiceClient::inputUserControlState(bool down) { if(mPTTIsToggle) { - if(down) // toggle open-mic state on 'down' + if(down) // toggle open-mic state on 'down' { toggleUserPTTState(); } } - else // set open-mic state as an absolute + else // set open-mic state as an absolute { setUserPTTState(down); } @@ -651,39 +646,23 @@ void LLVoiceClient::toggleUserPTTState(void) BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id) { - if (mNonSpatialVoiceModule) - { - return mNonSpatialVoiceModule->getVoiceEnabled(id); - } - else if (mSpatialVoiceModule) - { - return mSpatialVoiceModule->getVoiceEnabled(id); - } - else - { - return FALSE; - } + return isParticipant(id) ? TRUE : FALSE; } std::string LLVoiceClient::getDisplayName(const LLUUID& id) { - if (mNonSpatialVoiceModule) + std::string result = LLWebRTCVoiceClient::getInstance()->getDisplayName(id); + if (result.empty()) { - return mNonSpatialVoiceModule->getDisplayName(id); - } - else if (mSpatialVoiceModule) - { - return mSpatialVoiceModule->getDisplayName(id); - } - else - { - return std::string(); + result = LLVivoxVoiceClient::getInstance()->getDisplayName(id); } + return result; } bool LLVoiceClient::isVoiceWorking() const { - return LLVivoxVoiceClient::getInstance()->isVoiceWorking() || LLWebRTCVoiceClient::getInstance()->isVoiceWorking(); + return LLVivoxVoiceClient::getInstance()->isVoiceWorking() || + LLWebRTCVoiceClient::getInstance()->isVoiceWorking(); } BOOL LLVoiceClient::isParticipantAvatar(const LLUUID& id) @@ -698,48 +677,29 @@ BOOL LLVoiceClient::isOnlineSIP(const LLUUID& id) BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id) { - return LLVivoxVoiceClient::getInstance()->getIsSpeaking(id) || LLWebRTCVoiceClient::getInstance()->getIsSpeaking(id); + return LLWebRTCVoiceClient::getInstance()->getIsSpeaking(id) || + LLVivoxVoiceClient::getInstance()->getIsSpeaking(id); } BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id) { // don't bother worrying about p2p calls, as // p2p calls don't have mute. - if (mNonSpatialVoiceModule) - { - return mNonSpatialVoiceModule->getIsModeratorMuted(id); - } - else if (mSpatialVoiceModule) - { - return mSpatialVoiceModule->getIsModeratorMuted(id); - } - else - { - return FALSE; - } + return LLWebRTCVoiceClient::getInstance()->getIsModeratorMuted(id) || + LLVivoxVoiceClient::getInstance()->getIsModeratorMuted(id); } F32 LLVoiceClient::getCurrentPower(const LLUUID& id) -{ - return std::fmax(LLVivoxVoiceClient::getInstance()->getCurrentPower(id), LLWebRTCVoiceClient::getInstance()->getCurrentPower(id)); +{ + return std::fmax(LLVivoxVoiceClient::getInstance()->getCurrentPower(id), + LLWebRTCVoiceClient::getInstance()->getCurrentPower(id)); } BOOL LLVoiceClient::getOnMuteList(const LLUUID& id) { // don't bother worrying about p2p calls, as // p2p calls don't have mute. - if (mNonSpatialVoiceModule) - { - return mNonSpatialVoiceModule->getOnMuteList(id); - } - else if (mSpatialVoiceModule) - { - return mSpatialVoiceModule->getOnMuteList(id); - } - else - { - return FALSE; - } + return LLMuteList::getInstance()->isMuted(id, LLMute::flagVoiceChat); } F32 LLVoiceClient::getUserVolume(const LLUUID& id) @@ -798,7 +758,7 @@ std::string LLVoiceClient::sipURIFromID(const LLUUID &id) { return mNonSpatialVoiceModule->sipURIFromID(id); } - else if (mSpatialVoiceModule) + else if (mSpatialVoiceModule) { return mSpatialVoiceModule->sipURIFromID(id); } @@ -854,7 +814,7 @@ class LLViewerRequiredVoiceVersion : public LLHTTPNode } LLVoiceVersionInfo versionInfo = voiceModule->getVersion(); - if (input.has("body") && input["body"].has("major_version") && + if (input.has("body") && input["body"].has("major_version") && input["body"]["major_version"].asInteger() > versionInfo.majorVersion) { if (!sAlertedUser) @@ -879,26 +839,26 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode { //the parcel you are in has changed something about its //voice information - + //this is a misnomer, as it can also be when you are not in //a parcel at all. Should really be something like //LLViewerVoiceInfoChanged..... if ( input.has("body") ) { LLSD body = input["body"]; - + //body has "region_name" (str), "parcel_local_id"(int), //"voice_credentials" (map). - + //body["voice_credentials"] has "channel_uri" (str), //body["voice_credentials"] has "channel_credentials" (str) - + //if we really wanted to be extra careful, //we'd check the supplied //local parcel id to make sure it's for the same parcel //we believe we're in if ( body.has("voice_credentials") ) - { + { LLVoiceClient::getInstance()->setSpatialChannel(body["voice_credentials"]); } } @@ -941,7 +901,7 @@ void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 vo bool LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id, F32& volume) { speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id); - + if (it != mSpeakersData.end()) { volume = it->second; @@ -1020,9 +980,9 @@ void LLSpeakerVolumeStorage::load() if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings_llsd, file)) { LL_WARNS("Voice") << "failed to parse " << filename << LL_ENDL; - + } - + } for (LLSD::map_const_iterator iter = settings_llsd.beginMap(); -- cgit v1.2.3 From 1f177d837c51c0b5751204ffbd39c5e1e7a51212 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Mon, 11 Mar 2024 14:41:12 -0700 Subject: fixup tabs --- indra/newview/llvoiceclient.cpp | 169 ++++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 86 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 33e76c14ae..1f5dbe3b97 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -176,69 +176,69 @@ void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &age void LLVoiceClient::onRegionChanged() { - LLViewerRegion *region = gAgent.getRegion(); - if (region && region->simulatorFeaturesReceived()) - { - LLSD simulatorFeatures; - region->getSimulatorFeatures(simulatorFeatures); - setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); - } - else if (region) - { + LLViewerRegion *region = gAgent.getRegion(); + if (region && region->simulatorFeaturesReceived()) + { + LLSD simulatorFeatures; + region->getSimulatorFeatures(simulatorFeatures); + setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + } + else if (region) + { if (mSimulatorFeaturesReceivedSlot.connected()) { mSimulatorFeaturesReceivedSlot.disconnect(); } mSimulatorFeaturesReceivedSlot = - region->setSimulatorFeaturesReceivedCallback( - boost::bind(&LLVoiceClient::onSimulatorFeaturesReceived, this, _1)); - } + region->setSimulatorFeaturesReceivedCallback( + boost::bind(&LLVoiceClient::onSimulatorFeaturesReceived, this, _1)); + } } void LLVoiceClient::onSimulatorFeaturesReceived(const LLUUID& region_id) { - LLViewerRegion *region = gAgent.getRegion(); - if (region && (region->getRegionID() == region_id)) - { - LLSD simulatorFeatures; - region->getSimulatorFeatures(simulatorFeatures); - setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); - } + LLViewerRegion *region = gAgent.getRegion(); + if (region && (region->getRegionID() == region_id)) + { + LLSD simulatorFeatures; + region->getSimulatorFeatures(simulatorFeatures); + setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + } } void LLVoiceClient::setSpatialVoiceModule(const std::string &voice_server_type) { - LLVoiceModuleInterface *module = getVoiceModule(voice_server_type); - if (!module) + LLVoiceModuleInterface *module = getVoiceModule(voice_server_type); + if (!module) { - return; + return; } - if (module != mSpatialVoiceModule) - { + if (module != mSpatialVoiceModule) + { if (inProximalChannel()) { - mSpatialVoiceModule->processChannels(false); + mSpatialVoiceModule->processChannels(false); } - module->processChannels(true); - mSpatialVoiceModule = module; - mSpatialVoiceModule->updateSettings(); - } + module->processChannels(true); + mSpatialVoiceModule = module; + mSpatialVoiceModule->updateSettings(); + } } void LLVoiceClient::setNonSpatialVoiceModule(const std::string &voice_server_type) { - mNonSpatialVoiceModule = getVoiceModule(voice_server_type); - if (!mNonSpatialVoiceModule) - { + mNonSpatialVoiceModule = getVoiceModule(voice_server_type); + if (!mNonSpatialVoiceModule) + { // we don't have a non-spatial voice module, // so revert to spatial. if (mSpatialVoiceModule) { - mSpatialVoiceModule->processChannels(true); + mSpatialVoiceModule->processChannels(true); } - return; - } - mNonSpatialVoiceModule->updateSettings(); + return; + } + mNonSpatialVoiceModule->updateSettings(); } void LLVoiceClient::setHidden(bool hidden) @@ -296,14 +296,13 @@ void LLVoiceClient::updateSettings() void LLVoiceClient::tuningStart() { LLWebRTCVoiceClient::getInstance()->tuningStart(); - LLVivoxVoiceClient::getInstance()->tuningStart(); + LLVivoxVoiceClient::getInstance()->tuningStart(); } void LLVoiceClient::tuningStop() { LLWebRTCVoiceClient::getInstance()->tuningStop(); - LLVivoxVoiceClient::getInstance()->tuningStop(); - + LLVivoxVoiceClient::getInstance()->tuningStop(); } bool LLVoiceClient::inTuningMode() @@ -347,13 +346,13 @@ void LLVoiceClient::refreshDeviceLists(bool clearCurrentList) void LLVoiceClient::setCaptureDevice(const std::string& name) { LLWebRTCVoiceClient::getInstance()->setCaptureDevice(name); - LLVivoxVoiceClient::getInstance()->setCaptureDevice(name); + LLVivoxVoiceClient::getInstance()->setCaptureDevice(name); } void LLVoiceClient::setRenderDevice(const std::string& name) { LLWebRTCVoiceClient::getInstance()->setRenderDevice(name); - LLVivoxVoiceClient::getInstance()->setRenderDevice(name); + LLVivoxVoiceClient::getInstance()->setRenderDevice(name); } const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices() @@ -373,13 +372,13 @@ const LLVoiceDeviceList& LLVoiceClient::getRenderDevices() void LLVoiceClient::getParticipantList(std::set &participants) { - LLWebRTCVoiceClient::getInstance()->getParticipantList(participants); - LLVivoxVoiceClient::getInstance()->getParticipantList(participants); + LLWebRTCVoiceClient::getInstance()->getParticipantList(participants); + LLVivoxVoiceClient::getInstance()->getParticipantList(participants); } bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) { - return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) || + return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) || LLVivoxVoiceClient::getInstance()->isParticipant(speaker_id); } @@ -390,13 +389,13 @@ bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id) { // all sessions can do TextIM, as we no longer support PSTN - return TRUE; + return TRUE; } BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id) { // we don't support PSTN calls anymore. (did we ever?) - return TRUE; + return TRUE; } //---------------------------------------------- @@ -419,17 +418,17 @@ void LLVoiceClient::setNonSpatialChannel( bool notify_on_first_join, bool hangup_on_last_leave) { - setNonSpatialVoiceModule(channelInfo["voice_server_type"].asString()); + setNonSpatialVoiceModule(channelInfo["voice_server_type"].asString()); if (mSpatialVoiceModule) - { - mSpatialVoiceModule->processChannels(false); - } + { + mSpatialVoiceModule->processChannels(false); + } if (mNonSpatialVoiceModule) { - mNonSpatialVoiceModule->setNonSpatialChannel(channelInfo, notify_on_first_join, hangup_on_last_leave); - mNonSpatialVoiceModule->processChannels(true); + mNonSpatialVoiceModule->setNonSpatialChannel(channelInfo, notify_on_first_join, hangup_on_last_leave); + mNonSpatialVoiceModule->processChannels(true); + } } -} void LLVoiceClient::setSpatialChannel(const LLSD &channelInfo) { @@ -784,48 +783,46 @@ class LLViewerRequiredVoiceVersion : public LLHTTPNode const LLSD& context, const LLSD& input) const { - - - std::string voice_server_type = "vivox"; + std::string voice_server_type = "vivox"; if (input.has("body") && input["body"].has("voice_server_type")) { - voice_server_type = input["body"]["voice_server_type"].asString(); + voice_server_type = input["body"]["voice_server_type"].asString(); } - LLVoiceModuleInterface *voiceModule = NULL; + LLVoiceModuleInterface *voiceModule = NULL; - if (voice_server_type == "vivox" || voice_server_type.empty()) - { - voiceModule = (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); - } - else if (voice_server_type == "webrtc") - { - voiceModule = (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); - } - else - { - LL_WARNS("Voice") << "Unknown voice server type " << voice_server_type << LL_ENDL; - if (!sAlertedUser) - { - // sAlertedUser = true; - LLNotificationsUtil::add("VoiceVersionMismatch"); - } - return; - } + if (voice_server_type == "vivox" || voice_server_type.empty()) + { + voiceModule = (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); + } + else if (voice_server_type == "webrtc") + { + voiceModule = (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); + } + else + { + LL_WARNS("Voice") << "Unknown voice server type " << voice_server_type << LL_ENDL; + if (!sAlertedUser) + { + // sAlertedUser = true; + LLNotificationsUtil::add("VoiceVersionMismatch"); + } + return; + } LLVoiceVersionInfo versionInfo = voiceModule->getVersion(); - if (input.has("body") && input["body"].has("major_version") && + if (input.has("body") && input["body"].has("major_version") && input["body"]["major_version"].asInteger() > versionInfo.majorVersion) { - if (!sAlertedUser) - { - // sAlertedUser = true; - LLNotificationsUtil::add("VoiceVersionMismatch"); - LL_WARNS("Voice") << "Voice server version mismatch " << input["body"]["major_version"].asInteger() << "/" - << versionInfo.majorVersion - << LL_ENDL; - } - return; + if (!sAlertedUser) + { + // sAlertedUser = true; + LLNotificationsUtil::add("VoiceVersionMismatch"); + LL_WARNS("Voice") << "Voice server version mismatch " << input["body"]["major_version"].asInteger() << "/" + << versionInfo.majorVersion + << LL_ENDL; + } + return; } } }; -- cgit v1.2.3 From 37837edd69da48fe9ff74e69084e29c491327a78 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Mon, 11 Mar 2024 22:12:21 -0700 Subject: Fixup some logic relating to teleporting and new regions --- indra/newview/llvoiceclient.cpp | 113 +++++++++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 37 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 1f5dbe3b97..44e00b69e5 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -135,6 +135,7 @@ LLVoiceModuleInterface *getVoiceModule(const std::string &voice_server_type) LLVoiceClient::LLVoiceClient(LLPumpIO *pump) : mSpatialVoiceModule(NULL), + mNonSpatialVoiceModule(NULL), m_servicePump(NULL), mVoiceEffectEnabled(LLCachedControl(gSavedSettings, "VoiceMorphingEnabled", true)), mVoiceEffectDefault(LLCachedControl(gSavedPerAccountSettings, "VoiceEffectDefault", "00000000-0000-0000-0000-000000000000")), @@ -174,35 +175,71 @@ void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &age LLVivoxVoiceClient::getInstance()->userAuthorized(user_id, agentID); } -void LLVoiceClient::onRegionChanged() +void LLVoiceClient::handleSimulatorFeaturesReceived(const LLSD &simulatorFeatures) { - LLViewerRegion *region = gAgent.getRegion(); - if (region && region->simulatorFeaturesReceived()) + std::string voiceServerType = simulatorFeatures["VoiceServerType"].asString(); + if (voiceServerType.empty()) { - LLSD simulatorFeatures; - region->getSimulatorFeatures(simulatorFeatures); - setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + voiceServerType = VIVOX_VOICE_SERVER_TYPE; } - else if (region) + + if (mSpatialVoiceModule && !mNonSpatialVoiceModule) { - if (mSimulatorFeaturesReceivedSlot.connected()) + // stop processing if we're going to change voice modules + // and we're not currently in non-spatial. + LLVoiceVersionInfo version = mSpatialVoiceModule->getVersion(); + if (version.internalVoiceServerType != voiceServerType) { - mSimulatorFeaturesReceivedSlot.disconnect(); + mSpatialVoiceModule->processChannels(false); } - mSimulatorFeaturesReceivedSlot = - region->setSimulatorFeaturesReceivedCallback( - boost::bind(&LLVoiceClient::onSimulatorFeaturesReceived, this, _1)); + } + setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + + // if we should be in spatial voice, switch to it and set the creds + if (mSpatialVoiceModule && !mNonSpatialVoiceModule) + { + if (!mSpatialCredentials.isUndefined()) + { + mSpatialVoiceModule->setSpatialChannel(mSpatialCredentials); + } + mSpatialVoiceModule->processChannels(true); } } -void LLVoiceClient::onSimulatorFeaturesReceived(const LLUUID& region_id) +static void simulator_features_received_callback(const LLUUID& region_id) { LLViewerRegion *region = gAgent.getRegion(); if (region && (region->getRegionID() == region_id)) { LLSD simulatorFeatures; region->getSimulatorFeatures(simulatorFeatures); - setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + if (LLVoiceClient::getInstance()) + { + LLVoiceClient::getInstance()->handleSimulatorFeaturesReceived(simulatorFeatures); + } + } +} + +void LLVoiceClient::onRegionChanged() +{ + LLViewerRegion *region = gAgent.getRegion(); + if (region && region->simulatorFeaturesReceived()) + { + LLSD simulatorFeatures; + region->getSimulatorFeatures(simulatorFeatures); + if (LLVoiceClient::getInstance()) + { + LLVoiceClient::getInstance()->handleSimulatorFeaturesReceived(simulatorFeatures); + } + } + else if (region) + { + if (mSimulatorFeaturesReceivedSlot.connected()) + { + mSimulatorFeaturesReceivedSlot.disconnect(); + } + mSimulatorFeaturesReceivedSlot = + region->setSimulatorFeaturesReceivedCallback(boost::bind(&simulator_features_received_callback, _1)); } } @@ -419,37 +456,36 @@ void LLVoiceClient::setNonSpatialChannel( bool hangup_on_last_leave) { setNonSpatialVoiceModule(channelInfo["voice_server_type"].asString()); - if (mSpatialVoiceModule) + if (mSpatialVoiceModule && mSpatialVoiceModule != mNonSpatialVoiceModule) { mSpatialVoiceModule->processChannels(false); } if (mNonSpatialVoiceModule) { - mNonSpatialVoiceModule->setNonSpatialChannel(channelInfo, notify_on_first_join, hangup_on_last_leave); mNonSpatialVoiceModule->processChannels(true); + mNonSpatialVoiceModule->setNonSpatialChannel(channelInfo, notify_on_first_join, hangup_on_last_leave); } - } +} void LLVoiceClient::setSpatialChannel(const LLSD &channelInfo) { - LLViewerRegion *region = gAgent.getRegion(); - if (region && region->simulatorFeaturesReceived()) - { - LLSD simulatorFeatures; - region->getSimulatorFeatures(simulatorFeatures); - setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); - } - if (mNonSpatialVoiceModule) - { - mNonSpatialVoiceModule->leaveNonSpatialChannel(); - mNonSpatialVoiceModule->processChannels(false); - mNonSpatialVoiceModule = nullptr; - } + mSpatialCredentials = channelInfo; + LLViewerRegion *region = gAgent.getRegion(); + if (region && region->simulatorFeaturesReceived()) + { + LLSD simulatorFeatures; + region->getSimulatorFeatures(simulatorFeatures); + setSpatialVoiceModule(simulatorFeatures["VoiceServerType"].asString()); + } + else + { + return; + } + if (mSpatialVoiceModule) - { - mSpatialVoiceModule->setSpatialChannel(channelInfo); - mSpatialVoiceModule->processChannels(true); - } + { + mSpatialVoiceModule->setSpatialChannel(channelInfo); + } } void LLVoiceClient::leaveNonSpatialChannel() @@ -564,9 +600,12 @@ void LLVoiceClient::updateMicMuteLogic() void LLVoiceClient::setMuteMic(bool muted) { - mMuteMic = muted; - updateMicMuteLogic(); - mMicroChangedSignal(); + if (mMuteMic != muted) + { + mMuteMic = muted; + updateMicMuteLogic(); + mMicroChangedSignal(); + } } -- cgit v1.2.3 From 76460e8c2c33af185ae8641775d5673fcdab0759 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Mon, 11 Mar 2024 22:45:36 -0700 Subject: Use LLCachedControl to speed up voice enable/disable checking --- indra/newview/llvoiceclient.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 44e00b69e5..b9b8742c41 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -569,7 +569,9 @@ void LLVoiceClient::setMicGain(F32 gain) bool LLVoiceClient::voiceEnabled() { - return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice") && !gNonInteractive; + static LLCachedControl enable_voice_chat(gSavedSettings, "EnableVoiceChat"); + static LLCachedControl cmd_line_disable_voice(gSavedSettings, "CmdLineDisableVoice"); + return enable_voice_chat && !cmd_line_disable_voice && !gNonInteractive; } void LLVoiceClient::setVoiceEnabled(bool enabled) -- cgit v1.2.3 From dbbbbc55af5c1b5e81e7a493a9b5fe5718f15c07 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Thu, 14 Mar 2024 20:04:39 -0700 Subject: Refactor device selection logic This refactor fixed a few bugs. There is an annoying 'click' when changing devices, however. This will be addressed in the future. --- indra/newview/llvoiceclient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index b9b8742c41..9dbf469ca8 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -382,14 +382,14 @@ void LLVoiceClient::refreshDeviceLists(bool clearCurrentList) void LLVoiceClient::setCaptureDevice(const std::string& name) { + LLVivoxVoiceClient::getInstance()->setCaptureDevice(name); LLWebRTCVoiceClient::getInstance()->setCaptureDevice(name); - LLVivoxVoiceClient::getInstance()->setCaptureDevice(name); } void LLVoiceClient::setRenderDevice(const std::string& name) { + LLVivoxVoiceClient::getInstance()->setRenderDevice(name); LLWebRTCVoiceClient::getInstance()->setRenderDevice(name); - LLVivoxVoiceClient::getInstance()->setRenderDevice(name); } const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices() -- cgit v1.2.3 From 1a1af1ce2989d384c5dabf4dce9bc150a69b02c1 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sat, 20 Apr 2024 00:26:39 -0700 Subject: Adjust logic for determine what voice server type to use. --- indra/newview/llvoiceclient.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 9dbf469ca8..6eadc3892e 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -538,12 +538,18 @@ LLVoiceP2PIncomingCallInterfacePtr LLVoiceClient::getIncomingCallInterface(const // outgoing calls LLVoiceP2POutgoingCallInterface *LLVoiceClient::getOutgoingCallInterface(const LLSD& voiceChannelInfo) { - std::string voiceServerType = gSavedSettings.getString("VoiceServerType"); + std::string voice_server_type = gSavedSettings.getString("VoiceServerType"); + if (voice_server_type.empty()) + { + // default to the server type associated with the region we're on. + LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); + voice_server_type = versionInfo.internalVoiceServerType; + } if (voiceChannelInfo.has("voice_server_type")) { - voiceServerType = voiceChannelInfo["voice_server_type"].asString(); + voice_server_type = voiceChannelInfo["voice_server_type"].asString(); } - LLVoiceModuleInterface *module = getVoiceModule(voiceServerType); + LLVoiceModuleInterface *module = getVoiceModule(voice_server_type); return dynamic_cast(module); } -- cgit v1.2.3 From c628c1f6e41f08c00540cf7f9ff3a5799faf0144 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 8 May 2024 14:22:43 -0700 Subject: Fix some session shutdown/error handling code --- indra/newview/llvoiceclient.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 6eadc3892e..8bd3897761 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -496,11 +496,6 @@ void LLVoiceClient::leaveNonSpatialChannel() mNonSpatialVoiceModule->processChannels(false); mNonSpatialVoiceModule = nullptr; } - if (mSpatialVoiceModule) - { - mSpatialVoiceModule->processChannels(true); - ; - } } void LLVoiceClient::activateSpatialChannel(bool activate) -- cgit v1.2.3 From cfd358f93350bf0ea487480d5c39bf48605b115b Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Thu, 16 May 2024 13:34:13 -0700 Subject: WebRTC clients calling Vivox clients should handle P2P --- indra/newview/llvoiceclient.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 8bd3897761..a4a6922fd2 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -540,9 +540,11 @@ LLVoiceP2POutgoingCallInterface *LLVoiceClient::getOutgoingCallInterface(const L LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); voice_server_type = versionInfo.internalVoiceServerType; } - if (voiceChannelInfo.has("voice_server_type")) + if (voiceChannelInfo.has("voice_server_type") && voiceChannelInfo["voice_server_type"] != voice_server_type) { - voice_server_type = voiceChannelInfo["voice_server_type"].asString(); + // there's a mismatch between what the peer is offering and what our server + // can handle, so downgrade to vivox + voice_server_type = VIVOX_VOICE_SERVER_TYPE; } LLVoiceModuleInterface *module = getVoiceModule(voice_server_type); return dynamic_cast(module); -- cgit v1.2.3 From 2b275d43fb70f396bba4249c34442e7d70a76e19 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 17 May 2024 13:27:45 -0700 Subject: Clean up some shutdown code. --- indra/newview/llvoiceclient.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index a4a6922fd2..e2d75e244f 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -157,7 +157,6 @@ LLVoiceClient::LLVoiceClient(LLPumpIO *pump) LLVoiceClient::~LLVoiceClient() { - llassert(!mSpatialVoiceModule); } void LLVoiceClient::init(LLPumpIO *pump) -- cgit v1.2.3 From 3eab42ebd832545d4ba51a39168110859b869370 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 21 Jun 2024 13:22:12 -0700 Subject: Disable voice morphing and throw up a warning if it's previously enabled. --- indra/newview/llvoiceclient.cpp | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index fb3377e9c0..779f4e3176 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -137,8 +137,9 @@ LLVoiceClient::LLVoiceClient(LLPumpIO *pump) mSpatialVoiceModule(NULL), mNonSpatialVoiceModule(NULL), m_servicePump(NULL), - mVoiceEffectEnabled(LLCachedControl(gSavedSettings, "VoiceMorphingEnabled", true)), + mVoiceEffectEnabled(LLCachedControl(gSavedSettings, "VoiceMorphingEnabled", false)), mVoiceEffectDefault(LLCachedControl(gSavedPerAccountSettings, "VoiceEffectDefault", "00000000-0000-0000-0000-000000000000")), + mVoiceEffectSupportNotified(false), mPTTDirty(true), mPTT(true), mUsePTT(true), @@ -569,11 +570,37 @@ void LLVoiceClient::setMicGain(F32 gain) //------------------------------------------ // enable/disable voice features +// static +bool LLVoiceClient::onVoiceEffectsNotSupported(const LLSD ¬ification, const LLSD &response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + switch (option) + { + case 0: // "Okay" + gSavedSettings.setBOOL("VoiceMorphingEnabled", FALSE); + break; + + case 1: // "Cancel" + break; + + default: + llassert(0); + break; + } + return false; +} + bool LLVoiceClient::voiceEnabled() { static LLCachedControl enable_voice_chat(gSavedSettings, "EnableVoiceChat"); static LLCachedControl cmd_line_disable_voice(gSavedSettings, "CmdLineDisableVoice"); - return enable_voice_chat && !cmd_line_disable_voice && !gNonInteractive; + bool enabled = enable_voice_chat && !cmd_line_disable_voice && !gNonInteractive; + if (enabled && !mVoiceEffectSupportNotified && getVoiceEffectEnabled() && !getVoiceEffectDefault().isNull()) + { + LLNotificationsUtil::add("VoiceEffectsNotSupported", LLSD(), LLSD(), &LLVoiceClient::onVoiceEffectsNotSupported); + mVoiceEffectSupportNotified = true; + } + return enabled; } void LLVoiceClient::setVoiceEnabled(bool enabled) @@ -812,7 +839,7 @@ std::string LLVoiceClient::sipURIFromID(const LLUUID &id) LLVoiceEffectInterface* LLVoiceClient::getVoiceEffectInterface() const { - return getVoiceEffectEnabled() ? dynamic_cast(mSpatialVoiceModule) : NULL; + return NULL; } /////////////////// -- cgit v1.2.3