send a message to the server when we're ready for data channel data

meow-7.2.2
Roxie Linden 2023-09-21 23:23:49 -07:00
parent dc56d0104d
commit 4624184f97
4 changed files with 27 additions and 2 deletions

View File

@ -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";

View File

@ -109,6 +109,7 @@ class LLWebRTCDataObserver
{
public:
virtual void OnDataReceived(const std::string& data, bool binary) = 0;
virtual void OnDataChannelReady() = 0;
};
class LLWebRTCDataInterface

View File

@ -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()
{

View File

@ -271,6 +271,7 @@ public:
/// LLWebRTCDataObserver
//@{
void OnDataReceived(const std::string& data, bool binary) override;
void OnDataChannelReady() override;
//@}
void processIceUpdates();