From 4b709e7944ad34bf82c63b8ee57661598bc2292f Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 20 Mar 2024 11:15:12 -0700 Subject: Turn procesIceUpdates into a coroutine to chop up the work a bit. --- indra/newview/llvoicewebrtc.cpp | 161 ++++++++++++++++------------------------ indra/newview/llvoicewebrtc.h | 7 +- 2 files changed, 66 insertions(+), 102 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 6aab67ca63..3446cf38f6 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -1997,7 +1997,6 @@ LLVoiceWebRTCConnection::LLVoiceWebRTCConnection(const LLUUID ®ionID, const s mVoiceConnectionState(VOICE_STATE_START_SESSION), mMuted(true), mShutDown(false), - mTrickling(false), mIceCompleted(false), mSpeakerVolume(0.0), mMicGain(0.0), @@ -2070,123 +2069,90 @@ void LLVoiceWebRTCConnection::OnIceCandidate(const llwebrtc::LLWebRTCIceCandidat LL::WorkQueue::postMaybe(mMainQueue, [=] { mIceCandidates.push_back(candidate); }); } -void LLVoiceWebRTCConnection::onIceUpdateComplete(bool ice_completed, const LLSD &result) -{ - mOutstandingRequests--; - if (LLWebRTCVoiceClient::isShuttingDown()) - { - return; - } - mTrickling = false; -} - -void LLVoiceWebRTCConnection::onIceUpdateError(int retries, std::string url, LLSD body, bool ice_completed, const LLSD &result) +void LLVoiceWebRTCConnection::processIceUpdates() { - if (LLWebRTCVoiceClient::isShuttingDown()) - { - mOutstandingRequests--; - return; - } - LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("voiceAccountProvision", httpPolicy)); - - if (retries >= 0) - { - LL_WARNS("Voice") << "Unable to complete ice trickling voice account, retrying. " << result << LL_ENDL; - LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost( - url, - LLCore::HttpRequest::DEFAULT_POLICY_ID, - body, - boost::bind(&LLVoiceWebRTCConnection::onIceUpdateComplete, this, ice_completed, _1), - boost::bind(&LLVoiceWebRTCConnection::onIceUpdateError, this, retries - 1, url, body, ice_completed, _1)); - return; - } - - LL_WARNS("Voice") << "Unable to complete ice trickling voice account, restarting connection. " << result << LL_ENDL; - if (!mShutDown) - { - setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); - } - mTrickling = false; - - mOutstandingRequests--; + mOutstandingRequests++; + LLCoros::getInstance()->launch("LLVoiceWebRTCConnection::requestVoiceConnectionCoro", + boost::bind(&LLVoiceWebRTCConnection::processIceUpdatesCoro, this)); } - // Ice candidates may be streamed in before or after the SDP offer is available (see below) // This function determines whether candidates are available to send to the Secondlife WebRTC // server via the simulator. If so, and there are no more candidates, this code // will make the cap call to the server sending up the ICE candidates. -void LLVoiceWebRTCConnection::processIceUpdates() +void LLVoiceWebRTCConnection::processIceUpdatesCoro() { if (mShutDown || LLWebRTCVoiceClient::isShuttingDown()) { + mOutstandingRequests--; return; } bool iceCompleted = false; LLSD body; + if (!mIceCandidates.empty() || mIceCompleted) { - if (!mTrickling) + LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID); + if (!regionp || !regionp->capabilitiesReceived()) { - if (!mIceCandidates.empty() || mIceCompleted) + LL_DEBUGS("Voice") << "no capabilities for ice gathering; waiting " << LL_ENDL; + mOutstandingRequests--; + return; + } + + std::string url = regionp->getCapability("VoiceSignalingRequest"); + if (url.empty()) + { + mOutstandingRequests--; + return; + } + + LL_DEBUGS("Voice") << "region ready to complete voice signaling; url=" << url << LL_ENDL; + if (!mIceCandidates.empty()) + { + LLSD candidates = LLSD::emptyArray(); + for (auto &ice_candidate : mIceCandidates) { - LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID); - if (!regionp || !regionp->capabilitiesReceived()) - { - LL_DEBUGS("Voice") << "no capabilities for ice gathering; waiting " << LL_ENDL; - return; - } + LLSD body_candidate; + body_candidate["sdpMid"] = ice_candidate.mSdpMid; + body_candidate["sdpMLineIndex"] = ice_candidate.mMLineIndex; + body_candidate["candidate"] = ice_candidate.mCandidate; + candidates.append(body_candidate); + } + body["candidates"] = candidates; + mIceCandidates.clear(); + } + else if (mIceCompleted) + { + LLSD body_candidate; + body_candidate["completed"] = true; + body["candidate"] = body_candidate; + iceCompleted = mIceCompleted; + mIceCompleted = false; + } - std::string url = regionp->getCapability("VoiceSignalingRequest"); - if (url.empty()) - { - return; - } + body["viewer_session"] = mViewerSession; + body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; - LL_DEBUGS("Voice") << "region ready to complete voice signaling; url=" << url << LL_ENDL; - if (!mIceCandidates.empty()) - { - LLSD candidates = LLSD::emptyArray(); - for (auto &ice_candidate : mIceCandidates) - { - LLSD body_candidate; - body_candidate["sdpMid"] = ice_candidate.mSdpMid; - body_candidate["sdpMLineIndex"] = ice_candidate.mMLineIndex; - body_candidate["candidate"] = ice_candidate.mCandidate; - candidates.append(body_candidate); - } - body["candidates"] = candidates; - mIceCandidates.clear(); - } - else if (mIceCompleted) - { - LLSD body_candidate; - body_candidate["completed"] = true; - body["candidate"] = body_candidate; - iceCompleted = mIceCompleted; - mIceCompleted = false; - } + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( + new LLCoreHttpUtil::HttpCoroutineAdapter("LLVoiceWebRTCAdHocConnection::breakVoiceConnection", + LLCore::HttpRequest::DEFAULT_POLICY_ID)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); - body["viewer_session"] = mViewerSession; - body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; - - LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( - new LLCoreHttpUtil::HttpCoroutineAdapter("voiceAccountProvision", httpPolicy)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions); - LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpPost( - url, - LLCore::HttpRequest::DEFAULT_POLICY_ID, - body, - boost::bind(&LLVoiceWebRTCSpatialConnection::onIceUpdateComplete, this, iceCompleted, _1), - boost::bind(&LLVoiceWebRTCSpatialConnection::onIceUpdateError, this, 3, url, body, iceCompleted, _1)); - mOutstandingRequests++; - mTrickling = true; - } + httpOpts->setWantHeaders(true); + + LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + if (!status) + { + // couldn't trickle the candidates, so restart the session. + setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); } } + mOutstandingRequests--; } @@ -2439,8 +2405,8 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection() mOutstandingRequests++; LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); - LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; - LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status) { @@ -2497,7 +2463,6 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() setVoiceConnectionState(VOICE_STATE_DISCONNECT); break; } - mTrickling = false; mIceCompleted = false; setVoiceConnectionState(VOICE_STATE_WAIT_FOR_SESSION_START); // tell the webrtc library that we want a connection. The library will diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 21fc79420b..4c82f5c9fa 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -603,10 +603,10 @@ class LLVoiceWebRTCConnection : void sendJoin(); void sendData(const std::string &data); - virtual void processIceUpdates(); - virtual void onIceUpdateComplete(bool ice_completed, const LLSD &result); - virtual void onIceUpdateError(int retries, std::string url, LLSD body, bool ice_completed, const LLSD &result); + void processIceUpdates(); + void processIceUpdatesCoro(); + virtual void setMuteMic(bool muted); virtual void setMicGain(F32 volume); virtual void setSpeakerVolume(F32 volume); @@ -697,7 +697,6 @@ class LLVoiceWebRTCConnection : std::vector mIceCandidates; bool mIceCompleted; - bool mTrickling; llwebrtc::LLWebRTCPeerConnectionInterface *mWebRTCPeerConnectionInterface; llwebrtc::LLWebRTCAudioInterface *mWebRTCAudioInterface; -- cgit v1.2.3 From e242c129f9d56161496a50397b79da1e444e8de4 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 22 Mar 2024 16:21:02 -0700 Subject: Add Tracy categories for WebRTC Voice Also: * Fix a few crashes. * Only send position data when it changes. --- indra/newview/llvoicewebrtc.cpp | 63 +++++++++++++++++++++++++++++++++++++---- indra/newview/llvoicewebrtc.h | 2 +- 2 files changed, 59 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 3446cf38f6..57c95777c2 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -290,6 +290,8 @@ const LLVoiceVersionInfo& LLWebRTCVoiceClient::getVersion() void LLWebRTCVoiceClient::updateSettings() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + setVoiceEnabled(LLVoiceClient::getInstance()->voiceEnabled()); setEarLocation(gSavedSettings.getS32("VoiceEarLocation")); @@ -314,6 +316,7 @@ void LLWebRTCVoiceClient::removeObserver(LLVoiceClientParticipantObserver *obser void LLWebRTCVoiceClient::notifyParticipantObservers() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE for (observer_set_t::iterator it = mParticipantObservers.begin(); it != mParticipantObservers.end();) { LLVoiceClientParticipantObserver *observer = *it; @@ -335,6 +338,8 @@ void LLWebRTCVoiceClient::removeObserver(LLVoiceClientStatusObserver *observer) void LLWebRTCVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + LL_DEBUGS("Voice") << "( " << LLVoiceClientStatusObserver::status2string(status) << " )" << " mSession=" << mSession << LL_ENDL; @@ -401,6 +406,7 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() LLMuteList::getInstance()->addObserver(this); while (!sShuttingDown) { + LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE("voiceConnectionCoroLoop") // TODO: Doing some measurement and calculation here, // we could reduce the timeout to take into account the // time spent on the previous loop to have the loop @@ -487,7 +493,7 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() sessionState::processSessionStates(); if (mProcessChannels && voiceEnabled && !mHidden) { - sendPositionUpdate(true); + sendPositionUpdate(false); updateOwnVolume(); } } @@ -516,6 +522,8 @@ void LLWebRTCVoiceClient::voiceConnectionCoro() // for cross-region voice. void LLWebRTCVoiceClient::updateNeighboringRegions() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + static const std::vector neighbors {LLVector3d(0.0f, 1.0f, 0.0f), LLVector3d(0.707f, 0.707f, 0.0f), LLVector3d(1.0f, 0.0f, 0.0f), LLVector3d(0.707f, -0.707f, 0.0f), LLVector3d(0.0f, -1.0f, 0.0f), LLVector3d(-0.707f, -0.707f, 0.0f), @@ -546,6 +554,8 @@ void LLWebRTCVoiceClient::updateNeighboringRegions() // shut down the current audio session to make room for the next one. void LLWebRTCVoiceClient::leaveAudioSession() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + if(mSession) { LL_DEBUGS("Voice") << "leaving session: " << mSession->mChannelID << LL_ENDL; @@ -599,6 +609,8 @@ void LLWebRTCVoiceClient::OnDevicesChanged(const llwebrtc::LLWebRTCVoiceDeviceLi void LLWebRTCVoiceClient::OnDevicesChangedImpl(const llwebrtc::LLWebRTCVoiceDeviceList &render_devices, const llwebrtc::LLWebRTCVoiceDeviceList &capture_devices) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice"); std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice"); @@ -782,6 +794,8 @@ void LLWebRTCVoiceClient::setHidden(bool hidden) // notify the observers. void LLWebRTCVoiceClient::OnConnectionEstablished(const std::string &channelID, const LLUUID ®ionID) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + if (gAgent.getRegion()->getRegionID() == regionID) { if (mNextSession && mNextSession->mChannelID == channelID) @@ -854,6 +868,8 @@ void LLWebRTCVoiceClient::setEarLocation(S32 loc) void LLWebRTCVoiceClient::updatePosition(void) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + LLViewerRegion *region = gAgent.getRegion(); if (region && isAgentAvatarValid()) { @@ -974,6 +990,8 @@ void LLWebRTCVoiceClient::enforceTether() // standard 50m void LLWebRTCVoiceClient::sendPositionUpdate(bool force) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + Json::FastWriter writer; std::string spatial_data; @@ -1085,6 +1103,8 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::addParticipantBy void LLWebRTCVoiceClient::removeParticipantByID(const std::string &channelID, const LLUUID &id) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + participantStatePtr_t result; LLWebRTCVoiceClient::sessionState::ptr_t session = sessionState::matchSessionByChannelID(channelID); if (session) @@ -1115,6 +1135,9 @@ LLWebRTCVoiceClient::participantState::participantState(const LLUUID& agent_id) LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::addParticipant(const LLUUID& agent_id) { + + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + participantStatePtr_t result; participantUUIDMap::iterator iter = mParticipantsByUUID.find(agent_id); @@ -1150,6 +1173,8 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::ad LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::findParticipantByID(const LLUUID& id) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + participantStatePtr_t result; participantUUIDMap::iterator iter = mParticipantsByUUID.find(id); @@ -1163,6 +1188,8 @@ LLWebRTCVoiceClient::participantStatePtr_t LLWebRTCVoiceClient::sessionState::fi void LLWebRTCVoiceClient::sessionState::removeParticipant(const LLWebRTCVoiceClient::participantStatePtr_t &participant) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + if (participant) { participantUUIDMap::iterator iter = mParticipantsByUUID.find(participant->mAvatarID); @@ -1401,6 +1428,8 @@ void LLWebRTCVoiceClient::predSetMicGain(const LLWebRTCVoiceClient::sessionState void LLWebRTCVoiceClient::setVoiceEnabled(bool enabled) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + LL_DEBUGS("Voice") << "( " << (enabled ? "enabled" : "disabled") << " )" << " was "<< (mVoiceEnabled ? "enabled" : "disabled") @@ -1803,6 +1832,8 @@ void LLWebRTCVoiceClient::sessionState::revive() void LLWebRTCVoiceClient::sessionState::processSessionStates() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + auto iter = mSessions.begin(); while (iter != mSessions.end()) { @@ -1822,6 +1853,8 @@ void LLWebRTCVoiceClient::sessionState::processSessionStates() // process the states on each connection associated with a session. bool LLWebRTCVoiceClient::sessionState::processConnectionStates() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + std::list::iterator iter = mWebRTCConnections.begin(); while (iter != mWebRTCConnections.end()) { @@ -1844,6 +1877,8 @@ bool LLWebRTCVoiceClient::sessionState::processConnectionStates() // on our location. bool LLWebRTCVoiceClient::estateSessionState::processConnectionStates() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + if (!mShuttingDown) { // Estate voice requires connection to neighboring regions. @@ -2082,6 +2117,8 @@ void LLVoiceWebRTCConnection::processIceUpdates() // will make the cap call to the server sending up the ICE candidates. void LLVoiceWebRTCConnection::processIceUpdatesCoro() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + if (mShutDown || LLWebRTCVoiceClient::isShuttingDown()) { mOutstandingRequests--; @@ -2135,7 +2172,7 @@ void LLVoiceWebRTCConnection::processIceUpdatesCoro() body["voice_server_type"] = WEBRTC_VOICE_SERVER_TYPE; LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter( - new LLCoreHttpUtil::HttpCoroutineAdapter("LLVoiceWebRTCAdHocConnection::breakVoiceConnection", + new LLCoreHttpUtil::HttpCoroutineAdapter("LLVoiceWebRTCAdHocConnection::processIceUpdatesCoro", LLCore::HttpRequest::DEFAULT_POLICY_ID)); LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); @@ -2301,8 +2338,10 @@ void LLVoiceWebRTCConnection::sendData(const std::string &data) // Tell the simulator that we're shutting down a voice connection. // The simulator will pass this on to the Secondlife WebRTC server. -void LLVoiceWebRTCConnection::breakVoiceConnection() +void LLVoiceWebRTCConnection::breakVoiceConnectionCoro() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + LL_DEBUGS("Voice") << "Disconnecting voice." << LL_ENDL; if (mWebRTCDataInterface) { @@ -2362,6 +2401,8 @@ void LLVoiceWebRTCConnection::breakVoiceConnection() // will use the offer and answer to negotiate the session. void LLVoiceWebRTCSpatialConnection::requestVoiceConnection() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID); LL_DEBUGS("Voice") << "Requesting voice connection." << LL_ENDL; @@ -2421,6 +2462,8 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection() void LLVoiceWebRTCConnection::OnVoiceConnectionRequestSuccess(const LLSD &result) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + if (LLWebRTCVoiceClient::isShuttingDown()) { return; @@ -2452,12 +2495,15 @@ void LLVoiceWebRTCConnection::OnVoiceConnectionRequestSuccess(const LLSD &result // Secondlife WebRTC server. bool LLVoiceWebRTCConnection::connectionStateMachine() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + processIceUpdates(); switch (getVoiceConnectionState()) { case VOICE_STATE_START_SESSION: { + LL_PROFILE_ZONE_NAMED_CATEGORY_VOICE("VOICE_STATE_START_SESSION") if (mShutDown) { setVoiceConnectionState(VOICE_STATE_DISCONNECT); @@ -2533,6 +2579,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() { sendJoin(); // tell the Secondlife WebRTC server that we're here via the data channel. setVoiceConnectionState(VOICE_STATE_SESSION_UP); + LLWebRTCVoiceClient::getInstance()->sendPositionUpdate(true); } break; } @@ -2569,8 +2616,8 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() break; case VOICE_STATE_DISCONNECT: - LLCoros::instance().launch("LLVoiceWebRTCConnection::breakVoiceConnection", - boost::bind(&LLVoiceWebRTCConnection::breakVoiceConnection, this)); + LLCoros::instance().launch("LLVoiceWebRTCConnection::breakVoiceConnectionCoro", + boost::bind(&LLVoiceWebRTCConnection::breakVoiceConnectionCoro, this)); break; case VOICE_STATE_WAIT_FOR_EXIT: @@ -2632,6 +2679,8 @@ void LLVoiceWebRTCConnection::OnDataReceived(const std::string& data, bool binar // this pointer. void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool binary) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + if (mShutDown) { return; @@ -2777,6 +2826,8 @@ void LLVoiceWebRTCConnection::OnDataChannelReady(llwebrtc::LLWebRTCDataInterface // to peers. void LLVoiceWebRTCConnection::sendJoin() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + Json::FastWriter writer; Json::Value root = Json::objectValue; Json::Value join_obj = Json::objectValue; @@ -2865,6 +2916,8 @@ LLVoiceWebRTCAdHocConnection::~LLVoiceWebRTCAdHocConnection() // So, we have a separate requestVoiceConnection call. void LLVoiceWebRTCAdHocConnection::requestVoiceConnection() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE + LLViewerRegion *regionp = LLWorld::instance().getRegionFromID(mRegionID); LL_DEBUGS("Voice") << "Requesting voice connection." << LL_ENDL; diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 4c82f5c9fa..f6ddc6dbe7 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -673,7 +673,7 @@ class LLVoiceWebRTCConnection : virtual void requestVoiceConnection() = 0; void requestVoiceConnectionCoro() { requestVoiceConnection(); } - void breakVoiceConnection(); + void breakVoiceConnectionCoro(); LLUUID mRegionID; LLUUID mViewerSession; -- cgit v1.2.3 From 168081c7e9c4fb89209aae225f849573caaf905a Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 22 Mar 2024 17:00:34 -0700 Subject: Validate that we're not shutting down after coroutine processing Coroutine yields can end after shutdown is requested and voice connections are removed, so we need to check that a shutdown hasn't occured before attempting to touch connection objects. (CR issue) --- indra/newview/llvoicewebrtc.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 57c95777c2..80e7323b6f 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2180,6 +2180,12 @@ void LLVoiceWebRTCConnection::processIceUpdatesCoro() httpOpts->setWantHeaders(true); LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); + + if (LLWebRTCVoiceClient::isShuttingDown()) + { + return; + } + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -2386,6 +2392,11 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro() // also shut things down. LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); + if (LLWebRTCVoiceClient::isShuttingDown()) + { + return; + } + if (mWebRTCPeerConnectionInterface) { mWebRTCPeerConnectionInterface->shutdownConnection(); -- cgit v1.2.3