diff options
author | Roxanne Skelly <roxie@lindenlab.com> | 2024-03-22 18:00:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 18:00:21 -0700 |
commit | 32e3a39e277d5cdf9085627a9f5b3dd3cbc11376 (patch) | |
tree | 8d37e0254194a91cd43171bd84ffc02b802bcdc8 /indra/llwebrtc | |
parent | 6047b61b2afc7eea0292e76920699aa7973bc33d (diff) | |
parent | 168081c7e9c4fb89209aae225f849573caaf905a (diff) |
Merge pull request #1036 from secondlife/roxie/webrtc-voice-workqueue
Move processIceUpdates into a coroutine
Diffstat (limited to 'indra/llwebrtc')
-rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 34d950b804..a92b480e3a 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -589,6 +589,9 @@ void LLWebRTCPeerConnectionImpl::terminate() rtc::scoped_refptr<webrtc::MediaStreamInterface> localStream; mLocalStream.swap(localStream); + mSignalingObserverList.clear(); + mDataObserverList.clear(); + mWebRTCImpl->PostSignalingTask( [=]() { @@ -1100,7 +1103,10 @@ void LLWebRTCPeerConnectionImpl::OnSetRemoteDescriptionComplete(webrtc::RTCError } } mCachedIceCandidates.clear(); - OnIceGatheringChange(mPeerConnection->ice_gathering_state()); + if (mPeerConnection) + { + OnIceGatheringChange(mPeerConnection->ice_gathering_state()); + } } @@ -1117,6 +1123,10 @@ void LLWebRTCPeerConnectionImpl::OnSetLocalDescriptionComplete(webrtc::RTCError void LLWebRTCPeerConnectionImpl::OnStateChange() { + if (!mDataChannel) + { + return; + } RTC_LOG(LS_INFO) << __FUNCTION__ << " Data Channel State: " << webrtc::DataChannelInterface::DataStateString(mDataChannel->state()); switch (mDataChannel->state()) { @@ -1160,7 +1170,12 @@ void LLWebRTCPeerConnectionImpl::sendData(const std::string& data, bool binary) { rtc::CopyOnWriteBuffer cowBuffer(data.data(), data.length()); webrtc::DataBuffer buffer(cowBuffer, binary); - mDataChannel->Send(buffer); + mWebRTCImpl->PostNetworkTask([this, buffer]() { + if (mDataChannel) + { + mDataChannel->Send(buffer); + } + }); } } |