diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-05-19 02:30:45 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-05-19 02:30:45 -0700 |
commit | ddbd1ab47ea6cd76ed3e6bf32ffaeb73a32b4a97 (patch) | |
tree | 2dc638dae2efac22cc3b4783b9ff0a371d58a044 | |
parent | 2b275d43fb70f396bba4249c34442e7d70a76e19 (diff) |
More session shutdown cleanup
-rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llfloaterimsession.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llfloaterimsession.h | 5 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llvoicechannel.h | 4 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 7 |
6 files changed, 34 insertions, 9 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index c72841e9e5..14fb63ec2a 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -280,9 +280,15 @@ void LLWebRTCImpl::terminate() { connection->terminate(); } - mPeerConnections.clear(); + + // connection->terminate() above spawns a number of Signaling thread calls to + // shut down the connection. The following Blocking Call will wait + // until they're done before it's executed, allowing time to clean up. mSignalingThread->BlockingCall([this]() { mPeerConnectionFactory = nullptr; }); + + mPeerConnections.clear(); + mWorkerThread->BlockingCall( [this]() { @@ -652,7 +658,6 @@ LLWebRTCPeerConnectionImpl::LLWebRTCPeerConnectionImpl() : LLWebRTCPeerConnectionImpl::~LLWebRTCPeerConnectionImpl() { - terminate(); mSignalingObserverList.clear(); mDataObserverList.clear(); } diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index c6868ffeda..ed61c75154 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -94,6 +94,7 @@ LLFloaterIMSession::LLFloaterIMSession(const LLUUID& session_id) mEnableCallbackRegistrar.add("Avatar.EnableGearItem", boost::bind(&LLFloaterIMSession::enableGearMenuItem, this, _2)); mCommitCallbackRegistrar.add("Avatar.GearDoToSelected", boost::bind(&LLFloaterIMSession::GearDoToSelected, this, _2)); mEnableCallbackRegistrar.add("Avatar.CheckGearItem", boost::bind(&LLFloaterIMSession::checkGearMenuItem, this, _2)); + mVoiceChannelChanged = LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLFloaterIMSession::onVoiceChannelChanged, this, _1)); setDocked(true); } @@ -292,6 +293,8 @@ LLFloaterIMSession::~LLFloaterIMSession() } LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); + + mVoiceChannelChanged.disconnect(); } @@ -521,6 +524,14 @@ void LLFloaterIMSession::sendParticipantsAddedNotification(const uuid_vec_t& uui sendMsg(getString(uuids.size() > 1 ? "multiple_participants_added" : "participant_added", args)); } +void LLFloaterIMSession::onVoiceChannelChanged(const LLUUID &session_id) +{ + if (session_id == mSessionID) + { + boundVoiceChannel(); + } +} + void LLFloaterIMSession::boundVoiceChannel() { LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index fc431f3ced..15b31e797f 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -161,6 +161,8 @@ private: void onCallButtonClicked(); + void onVoiceChannelChanged(const LLUUID &session_id); + void boundVoiceChannel(); // Add the "User is typing..." indicator. @@ -195,6 +197,9 @@ private: uuid_vec_t mInvitedParticipants; uuid_vec_t mPendingParticipants; + // notification when the voice channel is swapped out from beneath us. + boost::signals2::connection mVoiceChannelChanged; + // connection to voice channel state change signal boost::signals2::connection mVoiceChannelStateChangeConnection; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index a411329ffb..5e7814df51 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -789,10 +789,15 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, void LLIMModel::LLIMSession::initVoiceChannel(const LLSD& voiceChannelInfo) { - mVoiceChannelStateChangeConnection.disconnect(); if (mVoiceChannel) { + if (mVoiceChannel->isThisVoiceChannel(voiceChannelInfo)) + { + return; + } + mVoiceChannelStateChangeConnection.disconnect(); + mVoiceChannel->deactivate(); delete mVoiceChannel; diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index adc387e22d..62aae59fff 100644 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -93,6 +93,8 @@ public: void setCallDirection(EDirection direction) {mCallDirection = direction;} EDirection getCallDirection() {return mCallDirection;} + bool isThisVoiceChannel(const LLSD &voiceChannelInfo) { return LLVoiceClient::getInstance()->compareChannels(mChannelInfo, voiceChannelInfo); } + static LLVoiceChannel* getChannelByID(const LLUUID& session_id); static LLVoiceChannel* getCurrentVoiceChannel(); @@ -115,7 +117,7 @@ public: EState mState; std::string mSessionName; LLSD mNotifyArgs; - LLSD mChannelInfo; + LLSD mChannelInfo; // true if call was ended by agent bool mCallEndedByAgent; bool mIgnoreNextSessionLeave; diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 2ab4ae2edf..ddad470149 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2471,7 +2471,6 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro() httpOpts->setWantHeaders(true); mOutstandingRequests++; - setVoiceConnectionState(VOICE_STATE_WAIT_FOR_EXIT); // tell the server to shut down the connection as a courtesy. // shutdownConnection will drop the WebRTC connection which will @@ -2479,10 +2478,7 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro() LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); mOutstandingRequests--; - if (!LLWebRTCVoiceClient::isShuttingDown()) - { - setVoiceConnectionState(VOICE_STATE_SESSION_EXIT); - } + setVoiceConnectionState(VOICE_STATE_SESSION_EXIT); } // Tell the simulator to tell the Secondlife WebRTC server that we want a voice @@ -2745,6 +2741,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() break; case VOICE_STATE_DISCONNECT: + setVoiceConnectionState(VOICE_STATE_WAIT_FOR_EXIT); LLCoros::instance().launch("LLVoiceWebRTCConnection::breakVoiceConnectionCoro", boost::bind(&LLVoiceWebRTCConnection::breakVoiceConnectionCoro, this)); break; |