diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-02-01 21:53:33 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-22 23:11:37 -0800 |
commit | ead4feb6f56a2d62cdb3dcccbca683f340347f92 (patch) | |
tree | 886ea8653d46b4baba09eaeda61d9d9d5aba2e22 /indra | |
parent | bc05e7dcf4d64873816a96f04d6772c2a75be37c (diff) |
Hang up when peer hangs up in ad-hoc driven p2p call
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llvoicechannel.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llvoiceclient.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llvoiceclient.h | 10 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.h | 3 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 29 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.h | 10 |
7 files changed, 63 insertions, 27 deletions
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index afac9ed6f8..05c22dd645 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -437,7 +437,8 @@ void LLVoiceChannelGroup::activate() // we have the channel info, just need to use it now LLVoiceClient::getInstance()->setNonSpatialChannel( mURI, - mCredentials); + mCredentials, + !LLVoiceClient::getInstance()->hasP2PInterface()); if (!gAgent.isInGroup(mSessionID)) // ad-hoc channel { @@ -518,7 +519,8 @@ void LLVoiceChannelGroup::setChannelInfo( // we have the channel info, just need to use it now LLVoiceClient::getInstance()->setNonSpatialChannel( mURI, - mCredentials); + mCredentials, + !LLVoiceClient::getInstance()->hasP2PInterface()); } } @@ -527,6 +529,30 @@ void LLVoiceChannelGroup::handleStatusChange(EStatusType type) // status updates switch(type) { + case STATUS_LEFT_CHANNEL: + { + if (!LLVoiceClient::getInstance()->hasP2PInterface()) + { + // we're using group/adhoc for p2p + if (callStarted() && !mIgnoreNextSessionLeave && !sSuspended) + { + // *TODO: use it to show DECLINE voice notification + if (mState == STATE_RINGING) + { + // other user declined call + LLNotificationsUtil::add("P2PCallDeclined", mNotifyArgs); + } + else + { + // other user hung up, so we didn't end the call + mCallEndedByAgent = false; + } + deactivate(); + } + mIgnoreNextSessionLeave = FALSE; + return; + } + } case STATUS_JOINED: mRetries = 3; mIsRetrying = FALSE; 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); } } diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 1a20de6109..69004f2000 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -167,7 +167,8 @@ public: virtual bool inProximalChannel()=0; virtual void setNonSpatialChannel(const std::string &uri, - const std::string &credentials)=0; + const std::string &credentials, + bool hangup_on_last_leave = false)=0; virtual bool setSpatialChannel(const std::string &uri, const std::string &credentials)=0; @@ -371,9 +372,12 @@ public: // returns true iff the user is currently in a proximal (local spatial) channel. // Note that gestures should only fire if this returns true. bool inProximalChannel(); + void setNonSpatialChannel( - const std::string &uri, - const std::string &credentials); + const std::string &uri, + const std::string &credentials, + bool hangup_on_last_leave = false); + void setSpatialChannel( const std::string &uri, const std::string &credentials); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 3725510b6a..3c01f00596 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -5025,7 +5025,8 @@ void LLVivoxVoiceClient::joinSession(const sessionStatePtr_t &session) void LLVivoxVoiceClient::setNonSpatialChannel( const std::string &uri, - const std::string &credentials) + const std::string &credentials, + bool hangup_on_last_leave) { switchChannel(uri, false, false, false, credentials); } diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index bd1f18aec6..929ccce32b 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -135,7 +135,8 @@ public: virtual bool inProximalChannel(); virtual void setNonSpatialChannel(const std::string &uri, - const std::string &credentials); + const std::string &credentials, + bool hangup_on_last_leave); virtual bool setSpatialChannel(const std::string &uri, const std::string &credentials); diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index b10e967986..17b61465cc 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -485,11 +485,9 @@ bool LLWebRTCVoiceClient::sessionState::processConnectionStates() } -////////////////////////// -// LLWebRTCVoiceClient::estateSessionState - LLWebRTCVoiceClient::estateSessionState::estateSessionState() { + mHangupOnLastLeave = false; mChannelID = "Estate"; LLUUID region_id = gAgent.getRegion()->getRegionID(); @@ -498,14 +496,16 @@ LLWebRTCVoiceClient::estateSessionState::estateSessionState() LLWebRTCVoiceClient::parcelSessionState::parcelSessionState(const std::string &channelID, S32 parcel_local_id) { + mHangupOnLastLeave = false; LLUUID region_id = gAgent.getRegion()->getRegionID(); mChannelID = channelID; mWebRTCConnections.emplace_back(new LLVoiceWebRTCSpatialConnection(region_id, parcel_local_id, channelID)); } -LLWebRTCVoiceClient::adhocSessionState::adhocSessionState(const std::string &channelID, const std::string& credentials) : +LLWebRTCVoiceClient::adhocSessionState::adhocSessionState(const std::string &channelID, const std::string& credentials, bool hangup_on_last_leave) : mCredentials(credentials) { + mHangupOnLastLeave = hangup_on_last_leave; LLUUID region_id = gAgent.getRegion()->getRegionID(); mChannelID = channelID; mWebRTCConnections.emplace_back(new LLVoiceWebRTCAdHocConnection(region_id, channelID, credentials)); @@ -1181,6 +1181,12 @@ void LLWebRTCVoiceClient::removeParticipantByID(const std::string &channelID, co if (participant) { session->removeParticipant(participant); + if (session->mHangupOnLastLeave && + (id != gAgentID) && + (session->mParticipantsByURI.size() <= 1)) + { + notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); + } } } } @@ -1199,10 +1205,10 @@ bool LLWebRTCVoiceClient::startParcelSession(const std::string &channelID, S32 p return true; } -bool LLWebRTCVoiceClient::startAdHocSession(const std::string &channelID, const std::string &credentials) +bool LLWebRTCVoiceClient::startAdHocSession(const std::string &channelID, const std::string &credentials, bool hangup_on_last_leave) { leaveChannel(false); - mNextSession = addSession(channelID, sessionState::ptr_t(new adhocSessionState(channelID, credentials))); + mNextSession = addSession(channelID, sessionState::ptr_t(new adhocSessionState(channelID, credentials, hangup_on_last_leave))); return true; } @@ -1602,14 +1608,7 @@ void LLWebRTCVoiceClient::leaveChannel(bool stopTalking) if (mSession) { - // If we're already in a channel, or if we're joining one, terminate - // so we can rejoin with the new session data. - bool wasShuttingDown = mSession->mShuttingDown; deleteSession(mSession); - if (!wasShuttingDown) - { - notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); - } } if (mNextSession) @@ -2980,7 +2979,9 @@ void LLVoiceWebRTCSpatialConnection::setMuteMic(bool muted) ///////////////////////////// // WebRTC Spatial Connection -LLVoiceWebRTCAdHocConnection::LLVoiceWebRTCAdHocConnection(const LLUUID ®ionID, const std::string& channelID, const std::string& credentials) : +LLVoiceWebRTCAdHocConnection::LLVoiceWebRTCAdHocConnection(const LLUUID ®ionID, + const std::string& channelID, + const std::string& credentials) : LLVoiceWebRTCConnection(regionID, channelID), mCredentials(credentials) { diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 5ddfbd9ea4..e1a740929b 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -144,8 +144,8 @@ public: // Note that gestures should only fire if this returns true. bool inProximalChannel() override; - void setNonSpatialChannel(const std::string& uri, const std::string& credentials) override { - startAdHocSession(uri, credentials); + void setNonSpatialChannel(const std::string& uri, const std::string& credentials, bool hangup_on_last_leave) override { + startAdHocSession(uri, credentials, hangup_on_last_leave); } bool setSpatialChannel(const std::string &uri, const std::string &credentials) override @@ -388,6 +388,8 @@ public: static bool hasSession(const std::string &sessionID) { return mSessions.find(sessionID) != mSessions.end(); } + bool mHangupOnLastLeave; + protected: sessionState(); std::list<connectionPtr_t> mWebRTCConnections; @@ -428,7 +430,7 @@ public: class adhocSessionState : public sessionState { public: - adhocSessionState(const std::string &channelID, const std::string& credentials); + adhocSessionState(const std::string &channelID, const std::string& credentials, bool hangup_on_last_leave); bool isSpatial() override { return false; } bool isEstate() override { return false; } @@ -601,7 +603,7 @@ private: bool startEstateSession(); bool startParcelSession(const std::string& channelID, S32 parcelID); - bool startAdHocSession(const std::string& channelID, const std::string& credentials); + bool startAdHocSession(const std::string& channelID, const std::string& credentials, bool hangup_on_last_leave); void joinSession(const sessionStatePtr_t &session); |