diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-07-09 01:31:29 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-07-09 03:45:45 +0200 |
commit | ce3f086ec46f23358df086005fa14558def0d12f (patch) | |
tree | c95808afac69a6da684fe23b880edf6828a3ef3f /src/WebRTCLibPeerConnection.cpp | |
parent | 00ac03c8e7a96657de5b537cfc0396509546374e (diff) | |
download | fork-godot-webrtc-native-ce3f086ec46f23358df086005fa14558def0d12f.tar.gz fork-godot-webrtc-native-ce3f086ec46f23358df086005fa14558def0d12f.tar.bz2 fork-godot-webrtc-native-ce3f086ec46f23358df086005fa14558def0d12f.zip |
Move observers implementations into PeerConnection.
Diffstat (limited to 'src/WebRTCLibPeerConnection.cpp')
-rw-r--r-- | src/WebRTCLibPeerConnection.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/WebRTCLibPeerConnection.cpp b/src/WebRTCLibPeerConnection.cpp index 4b83ae6..eedeff0 100644 --- a/src/WebRTCLibPeerConnection.cpp +++ b/src/WebRTCLibPeerConnection.cpp @@ -7,6 +7,25 @@ using namespace godot_webrtc; std::unique_ptr<rtc::Thread> WebRTCLibPeerConnection::signaling_thread = nullptr; +// PeerConnectionObserver +void WebRTCLibPeerConnection::GodotPCO::OnIceCandidate(const webrtc::IceCandidateInterface *candidate) { + godot::Dictionary candidateSDP; + godot::String candidateSdpMidName = candidate->sdp_mid().c_str(); + int candidateSdpMlineIndexName = candidate->sdp_mline_index(); + std::string sdp; + candidate->ToString(&sdp); + godot::String candidateSdpName = sdp.c_str(); + parent->queue_signal("ice_candidate_created", 3, candidateSdpMidName, candidateSdpMlineIndexName, candidateSdpName); +} + +// CreateSessionDescriptionObserver +void WebRTCLibPeerConnection::GodotCSDO::OnSuccess(webrtc::SessionDescriptionInterface *desc) { + // serialize this offer and send it to the remote peer: + std::string sdp; + desc->ToString(&sdp); + parent->queue_signal("session_description_created", 2, desc->type().c_str(), sdp.c_str()); +} + void WebRTCLibPeerConnection::initialize_signaling() { if (signaling_thread.get() == nullptr) { signaling_thread = rtc::Thread::Create(); |