send a message to the server when we're ready for data channel data
parent
dc56d0104d
commit
4624184f97
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ class LLWebRTCDataObserver
|
|||
{
|
||||
public:
|
||||
virtual void OnDataReceived(const std::string& data, bool binary) = 0;
|
||||
virtual void OnDataChannelReady() = 0;
|
||||
};
|
||||
|
||||
class LLWebRTCDataInterface
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ public:
|
|||
/// LLWebRTCDataObserver
|
||||
//@{
|
||||
void OnDataReceived(const std::string& data, bool binary) override;
|
||||
void OnDataChannelReady() override;
|
||||
//@}
|
||||
|
||||
void processIceUpdates();
|
||||
|
|
|
|||
Loading…
Reference in New Issue