diff options
Diffstat (limited to 'indra/newview/llvoiceclient.cpp')
| -rw-r--r-- | indra/newview/llvoiceclient.cpp | 241 |
1 files changed, 88 insertions, 153 deletions
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 59e8db7752..22980f8047 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -25,9 +25,10 @@ */ #include "llvoiceclient.h" -#include "llvoicevivox.h" -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC #include "llvoicewebrtc.h" +#else +#include "llviewerregion.h" #endif #include "llviewernetwork.h" #include "llviewercontrol.h" @@ -41,6 +42,8 @@ #include "llagent.h" #include "lltrans.h" #include "lluiusage.h" +#include "llnearbyvoicemoderation.h" +#include "llmutelist.h" const F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f; @@ -118,17 +121,13 @@ std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserv LLVoiceModuleInterface *getVoiceModule(const std::string &voice_server_type) { - if (voice_server_type == VIVOX_VOICE_SERVER_TYPE || voice_server_type.empty()) - { - return (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); - } -#if !__FreeBSD__ && !_M_ARM64 - else if (voice_server_type == WEBRTC_VOICE_SERVER_TYPE) +#ifndef DISABLE_WEBRTC + if (voice_server_type == WEBRTC_VOICE_SERVER_TYPE || voice_server_type.empty()) { return (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); } -#endif else +#endif { LLNotificationsUtil::add("VoiceVersionMismatch"); return nullptr; @@ -169,10 +168,9 @@ void LLVoiceClient::init(LLPumpIO *pump) { // Initialize all of the voice modules m_servicePump = pump; -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->init(pump); #endif - LLVivoxVoiceClient::getInstance()->init(pump); } void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID) @@ -182,19 +180,20 @@ void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &age mRegionChangedCallbackSlot.disconnect(); } mRegionChangedCallbackSlot = gAgent.addRegionChangedCallback(boost::bind(&LLVoiceClient::onRegionChanged, this)); -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->userAuthorized(user_id, agentID); #endif - LLVivoxVoiceClient::getInstance()->userAuthorized(user_id, agentID); } void LLVoiceClient::handleSimulatorFeaturesReceived(const LLSD &simulatorFeatures) { std::string voiceServerType = simulatorFeatures["VoiceServerType"].asString(); +#ifndef DISABLE_WEBRTC if (voiceServerType.empty()) { - voiceServerType = VIVOX_VOICE_SERVER_TYPE; + voiceServerType = WEBRTC_VOICE_SERVER_TYPE; } +#endif if (mSpatialVoiceModule && !mNonSpatialVoiceModule) { @@ -294,24 +293,19 @@ void LLVoiceClient::setNonSpatialVoiceModule(const std::string &voice_server_typ void LLVoiceClient::setHidden(bool hidden) { LL_INFOS("Voice") << "( " << (hidden ? "true" : "false") << " )" << LL_ENDL; -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->setHidden(hidden); #endif - LLVivoxVoiceClient::getInstance()->setHidden(hidden); } void LLVoiceClient::terminate() { -#if !__FreeBSD__ && !_M_ARM64 - if (LLVivoxVoiceClient::instanceExists()) +#ifndef DISABLE_WEBRTC + if (LLWebRTCVoiceClient::instanceExists()) { LLWebRTCVoiceClient::getInstance()->terminate(); } #endif - if (LLVivoxVoiceClient::instanceExists()) - { - LLVivoxVoiceClient::getInstance()->terminate(); - } mSpatialVoiceModule = NULL; m_servicePump = NULL; @@ -346,10 +340,9 @@ void LLVoiceClient::updateSettings() updateMicMuteLogic(); -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->updateSettings(); #endif - LLVivoxVoiceClient::getInstance()->updateSettings(); } //-------------------------------------------------- @@ -357,53 +350,47 @@ void LLVoiceClient::updateSettings() void LLVoiceClient::tuningStart() { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->tuningStart(); #endif - LLVivoxVoiceClient::getInstance()->tuningStart(); } void LLVoiceClient::tuningStop() { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->tuningStop(); #endif - LLVivoxVoiceClient::getInstance()->tuningStop(); } bool LLVoiceClient::inTuningMode() { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC return LLWebRTCVoiceClient::getInstance()->inTuningMode(); #else - return LLVivoxVoiceClient::getInstance()->inTuningMode(); + return false; #endif } void LLVoiceClient::tuningSetMicVolume(float volume) { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->tuningSetMicVolume(volume); -#else - LLVivoxVoiceClient::getInstance()->tuningSetMicVolume(volume); #endif } void LLVoiceClient::tuningSetSpeakerVolume(float volume) { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->tuningSetSpeakerVolume(volume); -#else - LLVivoxVoiceClient::getInstance()->tuningSetSpeakerVolume(volume); #endif } float LLVoiceClient::tuningGetEnergy(void) { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC return LLWebRTCVoiceClient::getInstance()->tuningGetEnergy(); #else - return LLVivoxVoiceClient::getInstance()->tuningGetEnergy(); + return 0.f; #endif } @@ -412,63 +399,61 @@ float LLVoiceClient::tuningGetEnergy(void) bool LLVoiceClient::deviceSettingsAvailable() { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC return LLWebRTCVoiceClient::getInstance()->deviceSettingsAvailable(); #else - return LLVivoxVoiceClient::getInstance()->deviceSettingsAvailable(); + return false; #endif } bool LLVoiceClient::deviceSettingsUpdated() { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC return LLWebRTCVoiceClient::getInstance()->deviceSettingsUpdated(); #else - return LLVivoxVoiceClient::getInstance()->deviceSettingsUpdated(); + return false; #endif } void LLVoiceClient::refreshDeviceLists(bool clearCurrentList) { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->refreshDeviceLists(clearCurrentList); -#else - LLVivoxVoiceClient::getInstance()->refreshDeviceLists(clearCurrentList); #endif } void LLVoiceClient::setCaptureDevice(const std::string& name) { - LLVivoxVoiceClient::getInstance()->setCaptureDevice(name); -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->setCaptureDevice(name); #endif } void LLVoiceClient::setRenderDevice(const std::string& name) { - LLVivoxVoiceClient::getInstance()->setRenderDevice(name); -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->setRenderDevice(name); #endif } const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices() { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC return LLWebRTCVoiceClient::getInstance()->getCaptureDevices(); #else - return LLVivoxVoiceClient::getInstance()->getCaptureDevices(); + static LLVoiceDeviceList dummy_device_list; + return dummy_device_list; #endif } const LLVoiceDeviceList& LLVoiceClient::getRenderDevices() { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC return LLWebRTCVoiceClient::getInstance()->getRenderDevices(); #else - return LLVivoxVoiceClient::getInstance()->getRenderDevices(); + static LLVoiceDeviceList dummy_device_list; + return dummy_device_list; #endif } @@ -478,20 +463,18 @@ const LLVoiceDeviceList& LLVoiceClient::getRenderDevices() void LLVoiceClient::getParticipantList(std::set<LLUUID> &participants) const { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->getParticipantList(participants); #endif - LLVivoxVoiceClient::getInstance()->getParticipantList(participants); } bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) const { -#if !__FreeBSD__ && !_M_ARM64 - return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) || +#ifndef DISABLE_WEBRTC + return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id); #else - return + return false; #endif - LLVivoxVoiceClient::getInstance()->isParticipant(speaker_id); } @@ -583,22 +566,20 @@ void LLVoiceClient::activateSpatialChannel(bool activate) bool LLVoiceClient::isCurrentChannel(const LLSD& channelInfo) { -#if !__FreeBSD__ && !_M_ARM64 - return LLWebRTCVoiceClient::getInstance()->isCurrentChannel(channelInfo) || +#ifndef DISABLE_WEBRTC + return LLWebRTCVoiceClient::getInstance()->isCurrentChannel(channelInfo); #else - return + return false; #endif - LLVivoxVoiceClient::getInstance()->isCurrentChannel(channelInfo); } bool LLVoiceClient::compareChannels(const LLSD &channelInfo1, const LLSD &channelInfo2) { -#if !__FreeBSD__ && !_M_ARM64 - return LLWebRTCVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2) || +#ifndef DISABLE_WEBRTC + return LLWebRTCVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2); #else - return + return false; #endif - LLVivoxVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2); } LLVoiceP2PIncomingCallInterfacePtr LLVoiceClient::getIncomingCallInterface(const LLSD& voice_call_info) @@ -623,12 +604,14 @@ LLVoiceP2POutgoingCallInterface *LLVoiceClient::getOutgoingCallInterface(const L LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion(); voice_server_type = versionInfo.internalVoiceServerType; } +#ifndef DISABLE_WEBRTC if (voiceChannelInfo.has("voice_server_type") && voiceChannelInfo["voice_server_type"] != voice_server_type) { // 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; + // can handle, so default to webrtc + voice_server_type = WEBRTC_VOICE_SERVER_TYPE; } +#endif LLVoiceModuleInterface *module = getVoiceModule(voice_server_type); return dynamic_cast<LLVoiceP2POutgoingCallInterface *>(module); } @@ -639,18 +622,16 @@ LLVoiceP2POutgoingCallInterface *LLVoiceClient::getOutgoingCallInterface(const L void LLVoiceClient::setVoiceVolume(F32 volume) { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->setVoiceVolume(volume); #endif - LLVivoxVoiceClient::getInstance()->setVoiceVolume(volume); } void LLVoiceClient::setMicGain(F32 gain) { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->setMicGain(gain); #endif - LLVivoxVoiceClient::getInstance()->setMicGain(gain); } @@ -696,16 +677,12 @@ bool LLVoiceClient::voiceEnabled() void LLVoiceClient::setVoiceEnabled(bool enabled) { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC if (LLWebRTCVoiceClient::instanceExists()) { LLWebRTCVoiceClient::getInstance()->setVoiceEnabled(enabled); } #endif - if (LLVivoxVoiceClient::instanceExists()) - { - LLVivoxVoiceClient::getInstance()->setVoiceEnabled(enabled); - } } void LLVoiceClient::updateMicMuteLogic() @@ -724,10 +701,9 @@ void LLVoiceClient::updateMicMuteLogic() // Either of these always overrides any other PTT setting. new_mic_mute = true; } -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->setMuteMic(new_mic_mute); #endif - LLVivoxVoiceClient::getInstance()->setMuteMic(new_mic_mute); } void LLVoiceClient::setMuteMic(bool muted) @@ -748,6 +724,9 @@ void LLVoiceClient::setUserPTTState(bool ptt) { if (ptt) { + // Nearby chat is muted by moderator, don't toggle PTT + if (!mUserPTTState && LLNearbyVoiceModeration::getInstance()->showNotificationIfNeeded()) + return; LLUIUsage::instance().logCommand("Agent.EnableMicrophone"); } mUserPTTState = ptt; @@ -821,25 +800,20 @@ bool LLVoiceClient::getVoiceEnabled(const LLUUID& id) const std::string LLVoiceClient::getDisplayName(const LLUUID& id) const { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC std::string result = LLWebRTCVoiceClient::getInstance()->getDisplayName(id); - if (result.empty()) - { - result = LLVivoxVoiceClient::getInstance()->getDisplayName(id); - } - return result; #else - return LLVivoxVoiceClient::getInstance()->getDisplayName(id); + std::string result; #endif + return result; } bool LLVoiceClient::isVoiceWorking() const { -#if !__FreeBSD__ && !_M_ARM64 - return LLVivoxVoiceClient::getInstance()->isVoiceWorking() || - LLWebRTCVoiceClient::getInstance()->isVoiceWorking(); +#ifndef DISABLE_WEBRTC + return LLWebRTCVoiceClient::getInstance()->isVoiceWorking(); #else - return LLVivoxVoiceClient::getInstance()->isVoiceWorking(); + return false; #endif } @@ -855,33 +829,30 @@ bool LLVoiceClient::isOnlineSIP(const LLUUID& id) bool LLVoiceClient::getIsSpeaking(const LLUUID& id) { -#if !__FreeBSD__ && !_M_ARM64 - return LLWebRTCVoiceClient::getInstance()->getIsSpeaking(id) || +#ifndef DISABLE_WEBRTC + return LLWebRTCVoiceClient::getInstance()->getIsSpeaking(id); #else - return + return false; #endif - 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 !__FreeBSD__ && !_M_ARM64 - return LLWebRTCVoiceClient::getInstance()->getIsModeratorMuted(id) || +#ifndef DISABLE_WEBRTC + return LLWebRTCVoiceClient::getInstance()->getIsModeratorMuted(id); #else - return + return false; #endif - LLVivoxVoiceClient::getInstance()->getIsModeratorMuted(id); } F32 LLVoiceClient::getCurrentPower(const LLUUID& id) { -#if !__FreeBSD__ && !_M_ARM64 - return std::fmax(LLVivoxVoiceClient::getInstance()->getCurrentPower(id), - LLWebRTCVoiceClient::getInstance()->getCurrentPower(id)); +#ifndef DISABLE_WEBRTC + return LLWebRTCVoiceClient::getInstance()->getCurrentPower(id); #else - return LLVivoxVoiceClient::getInstance()->getCurrentPower(id); + return 0.f; #endif } @@ -894,19 +865,18 @@ bool LLVoiceClient::getOnMuteList(const LLUUID& id) F32 LLVoiceClient::getUserVolume(const LLUUID& id) { -#if !__FreeBSD__ && !_M_ARM64 - return std::fmax(LLVivoxVoiceClient::getInstance()->getUserVolume(id), LLWebRTCVoiceClient::getInstance()->getUserVolume(id)); +#ifndef DISABLE_WEBRTC + return LLWebRTCVoiceClient::getInstance()->getUserVolume(id); #else - return LLVivoxVoiceClient::getInstance()->getUserVolume(id); + return 0.f; #endif } void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume) { -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->setUserVolume(id, volume); #endif - LLVivoxVoiceClient::getInstance()->setUserVolume(id, volume); } //-------------------------------------------------- @@ -914,19 +884,14 @@ void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume) void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer) { - LLVivoxVoiceClient::getInstance()->addObserver(observer); -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->addObserver(observer); #endif } void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer) { - if (LLVivoxVoiceClient::instanceExists()) - { - LLVivoxVoiceClient::getInstance()->removeObserver(observer); - } -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC if (LLWebRTCVoiceClient::instanceExists()) { LLWebRTCVoiceClient::getInstance()->removeObserver(observer); @@ -936,19 +901,14 @@ void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer) void LLVoiceClient::addObserver(LLFriendObserver* observer) { - LLVivoxVoiceClient::getInstance()->addObserver(observer); -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->addObserver(observer); #endif } void LLVoiceClient::removeObserver(LLFriendObserver* observer) { - if (LLVivoxVoiceClient::instanceExists()) - { - LLVivoxVoiceClient::getInstance()->removeObserver(observer); - } -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC if (LLWebRTCVoiceClient::instanceExists()) { LLWebRTCVoiceClient::getInstance()->removeObserver(observer); @@ -958,19 +918,14 @@ void LLVoiceClient::removeObserver(LLFriendObserver* observer) void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer) { - LLVivoxVoiceClient::getInstance()->addObserver(observer); -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC LLWebRTCVoiceClient::getInstance()->addObserver(observer); #endif } void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer) { - if (LLVivoxVoiceClient::instanceExists()) - { - LLVivoxVoiceClient::getInstance()->removeObserver(observer); - } -#if !__FreeBSD__ && !_M_ARM64 +#ifndef DISABLE_WEBRTC if (LLWebRTCVoiceClient::instanceExists()) { LLWebRTCVoiceClient::getInstance()->removeObserver(observer); @@ -978,22 +933,6 @@ void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer) #endif } -std::string LLVoiceClient::sipURIFromID(const LLUUID &id) const -{ - if (mNonSpatialVoiceModule) - { - return mNonSpatialVoiceModule->sipURIFromID(id); - } - else if (mSpatialVoiceModule) - { - return mSpatialVoiceModule->sipURIFromID(id); - } - else - { - return std::string(); - } -} - LLSD LLVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const { if (mNonSpatialVoiceModule) @@ -1026,7 +965,7 @@ class LLViewerRequiredVoiceVersion : public LLHTTPNode const LLSD& context, const LLSD& input) const { - std::string voice_server_type = "vivox"; + std::string voice_server_type = "webrtc"; if (input.has("body") && input["body"].has("voice_server_type")) { voice_server_type = input["body"]["voice_server_type"].asString(); @@ -1034,17 +973,13 @@ class LLViewerRequiredVoiceVersion : public LLHTTPNode LLVoiceModuleInterface *voiceModule = NULL; - if (voice_server_type == "vivox" || voice_server_type.empty()) - { - voiceModule = (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); - } -#if !__FreeBSD__ && !_M_ARM64 - else if (voice_server_type == "webrtc") +#ifndef DISABLE_WEBRTC + if (voice_server_type == WEBRTC_VOICE_SERVER_TYPE || voice_server_type.empty()) { voiceModule = (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); } -#endif else +#endif { LL_WARNS("Voice") << "Unknown voice server type " << voice_server_type << LL_ENDL; if (!sAlertedUser) |
