summaryrefslogtreecommitdiff
path: root/src/GodotPeerConnectionObserver.cpp
diff options
context:
space:
mode:
authorBrandon Makin <bmicmak@gmail.com>2018-08-12 22:47:37 -0700
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-03-08 15:10:08 +0100
commit34fd1f8caa847d75ff7d5c6e3b8619b494608629 (patch)
treed91f06930c66014b19bea7fd4526736b69a676f5 /src/GodotPeerConnectionObserver.cpp
parenta44a5af115871b5be4dcfb05a421046a25ba5d73 (diff)
downloadgodot-webrtc-native-34fd1f8caa847d75ff7d5c6e3b8619b494608629.tar.gz
godot-webrtc-native-34fd1f8caa847d75ff7d5c6e3b8619b494608629.tar.bz2
godot-webrtc-native-34fd1f8caa847d75ff7d5c6e3b8619b494608629.zip
Import GSoC work to WebRTC GDNative implementation
Diffstat (limited to 'src/GodotPeerConnectionObserver.cpp')
-rw-r--r--src/GodotPeerConnectionObserver.cpp46
1 files changed, 46 insertions, 0 deletions
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<webrtc::MediaStreamInterface> stream) {
+}
+
+void WebRTCPeer::GodotPCO::OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
+}
+
+void WebRTCPeer::GodotPCO::OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> 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);
+}