summaryrefslogtreecommitdiff
path: root/indra/llwebrtc
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2024-03-22 16:21:02 -0700
committerRoxie Linden <roxie@lindenlab.com>2024-03-22 16:21:02 -0700
commite242c129f9d56161496a50397b79da1e444e8de4 (patch)
tree29eaef328f3abf0cb0dc9884645d74abc9b786a8 /indra/llwebrtc
parent4b709e7944ad34bf82c63b8ee57661598bc2292f (diff)
Add Tracy categories for WebRTC Voice
Also: * Fix a few crashes. * Only send position data when it changes.
Diffstat (limited to 'indra/llwebrtc')
-rw-r--r--indra/llwebrtc/llwebrtc.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp
index 1f129cf514..a92b480e3a 100644
--- a/indra/llwebrtc/llwebrtc.cpp
+++ b/indra/llwebrtc/llwebrtc.cpp
@@ -1103,7 +1103,10 @@ void LLWebRTCPeerConnectionImpl::OnSetRemoteDescriptionComplete(webrtc::RTCError
}
}
mCachedIceCandidates.clear();
- OnIceGatheringChange(mPeerConnection->ice_gathering_state());
+ if (mPeerConnection)
+ {
+ OnIceGatheringChange(mPeerConnection->ice_gathering_state());
+ }
}
@@ -1120,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())
{
@@ -1163,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);
+ }
+ });
}
}