diff options
author | Brad Linden <brad@lindenlab.com> | 2024-08-01 15:40:41 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2024-08-01 15:40:41 -0700 |
commit | 002be0f24321164a74ef2a88c656b7cb0968c7d3 (patch) | |
tree | 6a5a5944f8c5111bdf4e3364f28e003f38dc682f /indra/newview | |
parent | 2d69e4d2396d4d5d2e2b9d4959e668e57c08efd0 (diff) | |
parent | 5f66a15142083a047ac945da94f167c24c95f49a (diff) |
Merge remote-tracking branch 'origin/release/webrtc-voice' into release/2024.06-atlasaurus
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvoicechannel.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llvoiceclient.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llvoiceclient.h | 6 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 26 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.h | 6 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.h | 13 |
8 files changed, 82 insertions, 22 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4f851eabce..c68ce8d956 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2817,7 +2817,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled, const LLVector3 & // Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been // "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking. //----------------------------------------------------------------------------------------------------------------- - if (LLVoiceClient::getInstance()->getIsSpeaking( mID )) + if (LLVoiceClient::getInstance()->getIsSpeaking( mID ) && (!isInMuteList() || isSelf())) { if (!mVoiceVisualizer->getCurrentlySpeaking()) { diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index b95e43da8d..912b5a330e 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -768,6 +768,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID &session_id, mReceivedCall(false), mOutgoingCallInterface(outgoing_call_interface) { + mChannelInfo = LLVoiceClient::getInstance()->getP2PChannelInfoTemplate(other_user_id); } void LLVoiceChannelP2P::handleStatusChange(EStatusType type) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 4b299a51f5..264e11fe34 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -826,7 +826,7 @@ void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer) LLWebRTCVoiceClient::getInstance()->removeObserver(observer); } -std::string LLVoiceClient::sipURIFromID(const LLUUID &id) +std::string LLVoiceClient::sipURIFromID(const LLUUID &id) const { if (mNonSpatialVoiceModule) { @@ -842,6 +842,22 @@ std::string LLVoiceClient::sipURIFromID(const LLUUID &id) } } +LLSD LLVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const +{ + if (mNonSpatialVoiceModule) + { + return mNonSpatialVoiceModule->getP2PChannelInfoTemplate(id); + } + else if (mSpatialVoiceModule) + { + return mSpatialVoiceModule->getP2PChannelInfoTemplate(id); + } + else + { + return LLSD(); + } +} + LLVoiceEffectInterface* LLVoiceClient::getVoiceEffectInterface() const { return NULL; diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 9ae18b315c..ea67500109 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -281,7 +281,8 @@ public: virtual void removeObserver(LLVoiceClientParticipantObserver* observer)=0; //@} - virtual std::string sipURIFromID(const LLUUID &id)=0; + virtual std::string sipURIFromID(const LLUUID &id) const=0; + virtual LLSD getP2PChannelInfoTemplate(const LLUUID& id) const=0; //@} }; @@ -488,7 +489,8 @@ public: void addObserver(LLVoiceClientParticipantObserver* observer); void removeObserver(LLVoiceClientParticipantObserver* observer); - std::string sipURIFromID(const LLUUID &id); + std::string sipURIFromID(const LLUUID &id) const; + LLSD getP2PChannelInfoTemplate(const LLUUID& id) const; ////////////////////////// /// @name Voice effects diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 81325b5648..80e7fb27bd 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -298,7 +298,6 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() : mDevicesListUpdated(false), mAudioSession(), // TBD - should be NULL - mAudioSessionChanged(false), mNextAudioSession(), mCurrentParcelLocalID(0), @@ -1643,7 +1642,6 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession) LL_INFOS("Voice") << "Adding or joining voice session " << nextSession->mHandle << LL_ENDL; mAudioSession = nextSession; - mAudioSessionChanged = true; if (!mAudioSession || !mAudioSession->mReconnect) { mNextAudioSession.reset(); @@ -1900,9 +1898,8 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait) sessionStatePtr_t oldSession = mAudioSession; + notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); // needs mAudioSession for uri mAudioSession.reset(); - // We just notified status observers about this change. Don't do it again. - mAudioSessionChanged = false; // The old session may now need to be deleted. reapSession(oldSession); @@ -1910,9 +1907,9 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait) else { LL_WARNS("Voice") << "terminateAudioSession(" << wait << ") with NULL mAudioSession" << LL_ENDL; + notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); } - notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); // Always reset the terminate request flag when we get here. // Some slower PCs have a race condition where they can switch to an incoming P2P call faster than the state machine leaves @@ -3834,7 +3831,6 @@ void LLVivoxVoiceClient::joinedAudioSession(const sessionStatePtr_t &session) sessionStatePtr_t oldSession = mAudioSession; mAudioSession = session; - mAudioSessionChanged = true; // The old session may now need to be deleted. reapSession(oldSession); @@ -5144,7 +5140,7 @@ bool LLVivoxVoiceClient::inProximalChannel() return result; } -std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id) +std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id) const { std::string result; result = "sip:"; @@ -5155,6 +5151,14 @@ std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id) return result; } +LLSD LLVivoxVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const +{ + LLSD result; + result["channel_uri"] = sipURIFromID(id); + result["voice_server_type"] = VIVOX_VOICE_SERVER_TYPE; + return result; +} + std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar) { std::string result; @@ -5169,7 +5173,7 @@ std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar) return result; } -std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid) +std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid) const { std::string result; @@ -6149,7 +6153,6 @@ void LLVivoxVoiceClient::deleteSession(const sessionStatePtr_t &session) if(mAudioSession == session) { mAudioSession.reset(); - mAudioSessionChanged = true; } // ditto for the next audio session @@ -6258,9 +6261,10 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta } } + LLSD channel_info = getAudioSessionChannelInfo(); LL_DEBUGS("Voice") << " " << LLVoiceClientStatusObserver::status2string(status) - << ", session channelInfo " << getAudioSessionChannelInfo() + << ", session channelInfo " << channel_info << ", proximal is " << inSpatialChannel() << LL_ENDL; @@ -6275,7 +6279,7 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta ) { LLVoiceClientStatusObserver* observer = *it; - observer->onChange(status, getAudioSessionChannelInfo(), inSpatialChannel()); + observer->onChange(status, channel_info, inSpatialChannel()); // In case onError() deleted an entry. it = mStatusObservers.upper_bound(observer); } diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 420e0aa869..b0ce5df93c 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -221,7 +221,8 @@ public: void removeObserver(LLVoiceClientParticipantObserver* observer) override; //@} - std::string sipURIFromID(const LLUUID &id) override; + std::string sipURIFromID(const LLUUID &id) const override; + LLSD getP2PChannelInfoTemplate(const LLUUID& id) const override; //@} /// @name LLVoiceEffectInterface virtual implementations @@ -706,7 +707,6 @@ private: std::string mChannelName; // Name of the channel to be looked up sessionStatePtr_t mAudioSession; // Session state for the current audio session - bool mAudioSessionChanged; // set to true when the above pointer gets changed, so observers can be notified. sessionStatePtr_t mNextAudioSession; // Session state for the audio session we're trying to join @@ -748,7 +748,7 @@ private: bool switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = ""); void joinSession(const sessionStatePtr_t &session); - std::string nameFromID(const LLUUID &id); + std::string nameFromID(const LLUUID &id) const; bool IDFromName(const std::string name, LLUUID &uuid); std::string sipURIFromAvatar(LLVOAvatar *avatar); std::string sipURIFromName(std::string &name); diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index ede1542bd1..6737abf2a6 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -249,7 +249,7 @@ LLWebRTCVoiceClient::~LLWebRTCVoiceClient() void LLWebRTCVoiceClient::init(LLPumpIO* pump) { // constructor will set up LLVoiceClient::getInstance() - llwebrtc::init(); + llwebrtc::init(this); mWebRTCDeviceInterface = llwebrtc::getDeviceInterface(); mWebRTCDeviceInterface->setDevicesObserver(this); @@ -280,6 +280,29 @@ void LLWebRTCVoiceClient::cleanUp() LL_DEBUGS("Voice") << "Exiting" << LL_ENDL; } +void LLWebRTCVoiceClient::LogMessage(llwebrtc::LLWebRTCLogCallback::LogLevel level, const std::string& message) +{ + switch (level) + { + case llwebrtc::LLWebRTCLogCallback::LOG_LEVEL_VERBOSE: + LL_DEBUGS("Voice") << message << LL_ENDL; + break; + case llwebrtc::LLWebRTCLogCallback::LOG_LEVEL_INFO: + LL_INFOS("Voice") << message << LL_ENDL; + break; + case llwebrtc::LLWebRTCLogCallback::LOG_LEVEL_WARNING: + LL_WARNS("Voice") << message << LL_ENDL; + break; + case llwebrtc::LLWebRTCLogCallback::LOG_LEVEL_ERROR: + // use WARN so that we don't crash on a webrtc error. + // webrtc will force a crash on a fatal error. + LL_WARNS("Voice") << message << LL_ENDL; + break; + default: + break; + } +} + // -------------------------------------------------- const LLVoiceVersionInfo& LLWebRTCVoiceClient::getVersion() @@ -2068,11 +2091,16 @@ void LLWebRTCVoiceClient::avatarNameResolved(const LLUUID &id, const std::string } // Leftover from vivox PTSN -std::string LLWebRTCVoiceClient::sipURIFromID(const LLUUID& id) +std::string LLWebRTCVoiceClient::sipURIFromID(const LLUUID& id) const { return id.asString(); } +LLSD LLWebRTCVoiceClient::getP2PChannelInfoTemplate(const LLUUID& id) const +{ + return LLSD(); +} + ///////////////////////////// // LLVoiceWebRTCConnection diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 480a7897cd..2b9a113fcc 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -62,7 +62,8 @@ extern const std::string WEBRTC_VOICE_SERVER_TYPE; class LLWebRTCVoiceClient : public LLSingleton<LLWebRTCVoiceClient>, virtual public LLVoiceModuleInterface, public llwebrtc::LLWebRTCDevicesObserver, - public LLMuteListObserver + public LLMuteListObserver, + public llwebrtc::LLWebRTCLogCallback { LLSINGLETON(LLWebRTCVoiceClient); LOG_CLASS(LLWebRTCVoiceClient); @@ -84,7 +85,15 @@ public: // Returns true if WebRTC has successfully logged in and is not in error state bool isVoiceWorking() const override; - std::string sipURIFromID(const LLUUID &id) override; + std::string sipURIFromID(const LLUUID &id) const override; + LLSD getP2PChannelInfoTemplate(const LLUUID& id) const override; + + + /////////////////// + /// @name Logging + /// @{ + void LogMessage(llwebrtc::LLWebRTCLogCallback::LogLevel level, const std::string& message) override; + //@} ///////////////////// /// @name Tuning |