diff options
author | Roxie Linden <roxie@lindenlab.com> | 2023-09-21 23:23:49 -0700 |
---|---|---|
committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-08 18:34:01 -0800 |
commit | 64ec3cb19ffeeb25d7d235e60629c9b4890986f1 (patch) | |
tree | 95891ed754a81f2149148e64f62fca72d105ce6e | |
parent | 3f1fa296696086efe618bdbd3c6f636b6e1163b1 (diff) |
send a message to the server when we're ready for data channel data
-rw-r--r-- | indra/llwebrtc/llwebrtc.cpp | 17 | ||||
-rw-r--r-- | indra/llwebrtc/llwebrtc.h | 1 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 10 | ||||
-rw-r--r-- | indra/newview/llvoicewebrtc.h | 1 |
4 files changed, 27 insertions, 2 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 1913786c0b..dc746b7629 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -78,13 +78,22 @@ void LLWebRTCImpl::terminate() mPeerConnection->Close(); mPeerConnection = nullptr; } + mPeerConnectionFactory = nullptr; }); mWorkerThread->BlockingCall( [this]() { - if (mDeviceModule) + mDeviceModule = nullptr; + mTaskQueueFactory = nullptr; + + }); + mNetworkThread->BlockingCall( + [this]() + { + if (mDataChannel) { - mDeviceModule = nullptr; + mDataChannel->Close(); + mDataChannel = nullptr; } }); } @@ -681,6 +690,10 @@ void LLWebRTCImpl::OnStateChange() { case webrtc::DataChannelInterface::kOpen: RTC_LOG(LS_INFO) << __FUNCTION__ << " Data Channel State Open"; + for (auto &observer : mDataObserverList) + { + observer->OnDataChannelReady(); + } break; case webrtc::DataChannelInterface::kConnecting: RTC_LOG(LS_INFO) << __FUNCTION__ << " Data Channel State Connecting"; diff --git a/indra/llwebrtc/llwebrtc.h b/indra/llwebrtc/llwebrtc.h index f1ba1620e3..d0d2834e3c 100644 --- a/indra/llwebrtc/llwebrtc.h +++ b/indra/llwebrtc/llwebrtc.h @@ -109,6 +109,7 @@ class LLWebRTCDataObserver { public: virtual void OnDataReceived(const std::string& data, bool binary) = 0; + virtual void OnDataChannelReady() = 0; }; class LLWebRTCDataInterface diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index a942eb8288..b621f5ee92 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2682,6 +2682,16 @@ void LLWebRTCVoiceClient::OnDataReceived(const std::string& data, bool binary) } } +void LLWebRTCVoiceClient::OnDataChannelReady() +{ + // send a join + Json::FastWriter writer; + Json::Value root; + root["j"] = true; + std::string json_data = writer.write(root); + mWebRTCDataInterface->sendData(json_data, false); +} + void LLWebRTCVoiceClient::OnRenegotiationNeeded() { diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 6ddda0ef94..bc858dcb32 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -271,6 +271,7 @@ public: /// LLWebRTCDataObserver //@{ void OnDataReceived(const std::string& data, bool binary) override; + void OnDataChannelReady() override; //@} void processIceUpdates(); |