diff options
author | Roxie Linden <roxie@lindenlab.com> | 2024-03-03 22:34:35 -0800 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-03-03 22:34:35 -0800 |
commit | b17c668d1257ba66e6a0bf84d0ad4c0da785ad64 (patch) | |
tree | a8397faed31a0a90322f178726be04cf2e2521aa /indra/newview/llvoicewebrtc.cpp | |
parent | 2117f8c4ba4565eef33f139a8c38b81f3c79648f (diff) |
fix webrtc logic bugs and such
Diffstat (limited to 'indra/newview/llvoicewebrtc.cpp')
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 791c733dcc..093f0a6d29 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -575,10 +575,8 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() // leave channel can be called again and again without adverse effects. // it merely tells channels to shut down if they're not already doing so. leaveChannel(false); - continue; } - - if (inSpatialChannel()) + else if (inSpatialChannel()) { // add session for region or parcel voice. if (!regionp || regionp->getRegionID().isNull()) @@ -637,7 +635,7 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() } sessionState::processSessionStates(); - if (voiceEnabled) + if (mProcessChannels && voiceEnabled) { sendPositionUpdate(true); updateOwnVolume(); @@ -1274,8 +1272,9 @@ bool LLWebRTCVoiceClient::startParcelSession(const std::string &channelID, S32 p bool LLWebRTCVoiceClient::startAdHocSession(const LLSD& channelInfo, bool hangup_on_last_leave) { leaveChannel(false); - std::string channelID = channelInfo["channel"]; - std::string credentials = channelInfo["credentials"]; + LL_WARNS("Voice") << "Start AdHoc Session " << channelInfo << LL_ENDL; + std::string channelID = channelInfo["channel_uri"]; + std::string credentials = channelInfo["channel_credentials"]; mNextSession = addSession(channelID, sessionState::ptr_t(new adhocSessionState(channelID, credentials, hangup_on_last_leave))); return true; } @@ -1452,7 +1451,7 @@ bool LLWebRTCVoiceClient::inSpatialChannel() return result; } -std::string LLWebRTCVoiceClient::getAudioSessionChannelInfo() +LLSD LLWebRTCVoiceClient::getAudioSessionChannelInfo() { LLSD result; @@ -1644,8 +1643,17 @@ void LLWebRTCVoiceClient::leaveChannel(bool stopTalking) bool LLWebRTCVoiceClient::isCurrentChannel(const LLSD &channelInfo) { - return (channelInfo["voice_server_type"].asString() == WEBRTC_VOICE_SERVER_TYPE) && - (sessionState::hasSession(channelInfo["session_handle"].asString())); + if (channelInfo["voice_server_type"].asString() != WEBRTC_VOICE_SERVER_TYPE) + return false; + if (mSession) + { + if (!channelInfo["sessionHandle"].asString().empty()) + { + return mSession->mHandle == channelInfo["session_handle"].asString(); + } + return channelInfo["channel_uri"].asString() == mSession->mChannelID; + } + return false; } bool LLWebRTCVoiceClient::compareChannels(const LLSD &channelInfo1, const LLSD &channelInfo2) @@ -2248,12 +2256,13 @@ void LLWebRTCVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESt mIsProcessingChannels = status == LLVoiceClientStatusObserver::STATUS_JOINED; + LLSD channelInfo = getAudioSessionChannelInfo(); for (status_observer_set_t::iterator it = mStatusObservers.begin(); it != mStatusObservers.end(); ) { LLVoiceClientStatusObserver* observer = *it; - observer->onChange(status, getAudioSessionChannelInfo(), inSpatialChannel()); + observer->onChange(status, channelInfo, inSpatialChannel()); // In case onError() deleted an entry. it = mStatusObservers.upper_bound(observer); } @@ -3151,6 +3160,7 @@ bool LLVoiceWebRTCAdHocConnection::requestVoiceConnection() body["credentials"] = mCredentials; body["channel"] = mChannelID; body["channel_type"] = "multiagent"; + body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost( url, |