From 34fd1f8caa847d75ff7d5c6e3b8619b494608629 Mon Sep 17 00:00:00 2001 From: Brandon Makin Date: Sun, 12 Aug 2018 22:47:37 -0700 Subject: Import GSoC work to WebRTC GDNative implementation --- src/GodotPeerConnectionObserver.cpp | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/GodotPeerConnectionObserver.cpp (limited to 'src/GodotPeerConnectionObserver.cpp') diff --git a/src/GodotPeerConnectionObserver.cpp b/src/GodotPeerConnectionObserver.cpp new file mode 100644 index 0000000..572b6d7 --- /dev/null +++ b/src/GodotPeerConnectionObserver.cpp @@ -0,0 +1,46 @@ +#include "WebRTCPeer.hpp" + +using namespace godot_webrtc; + +WebRTCPeer::GodotPCO::GodotPCO(WebRTCPeer *parent) { + this->parent = parent; +} + +void WebRTCPeer::GodotPCO::OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) { +} + +void WebRTCPeer::GodotPCO::OnAddStream(rtc::scoped_refptr stream) { +} + +void WebRTCPeer::GodotPCO::OnRemoveStream(rtc::scoped_refptr stream) { +} + +void WebRTCPeer::GodotPCO::OnDataChannel(rtc::scoped_refptr data_channel) { +} + +void WebRTCPeer::GodotPCO::OnRenegotiationNeeded() { +} + +void WebRTCPeer::GodotPCO::OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) { +} + +void WebRTCPeer::GodotPCO::OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) { +} + +void WebRTCPeer::GodotPCO::OnIceCandidate(const webrtc::IceCandidateInterface *candidate) { + // Serialize the candidate and send it to the remote peer: + + 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("new_ice_candidate", + 3, + candidateSdpMidName, + candidateSdpMlineIndexName, + candidateSdpName); +} -- cgit v1.2.3