From 3e64a42b1492e38bf033041c0eb1212542728cbd Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Sun, 21 Apr 2019 04:57:53 +0200 Subject: Update to new DataChannel API. New WebRTCLibDataChannel class act as PacketPeer. Old WebRTCPeer (now WebRTCPeerConnection) now allows you to set configuration (STUN/TURN) and creating multiple data channels. Fixed many bugs and implemented most of the missing API. --- src/GodotPeerConnectionObserver.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/GodotPeerConnectionObserver.cpp') diff --git a/src/GodotPeerConnectionObserver.cpp b/src/GodotPeerConnectionObserver.cpp index 298cfcf..c3f8f39 100644 --- a/src/GodotPeerConnectionObserver.cpp +++ b/src/GodotPeerConnectionObserver.cpp @@ -1,33 +1,35 @@ -#include "WebRTCLibPeer.hpp" +#include "WebRTCLibPeerConnection.hpp" +#include "WebRTCLibDataChannel.hpp" using namespace godot_webrtc; -WebRTCLibPeer::GodotPCO::GodotPCO(WebRTCLibPeer *parent) { +WebRTCLibPeerConnection::GodotPCO::GodotPCO(WebRTCLibPeerConnection *parent) { this->parent = parent; } -void WebRTCLibPeer::GodotPCO::OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) { +void WebRTCLibPeerConnection::GodotPCO::OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) { } -void WebRTCLibPeer::GodotPCO::OnAddStream(rtc::scoped_refptr stream) { +void WebRTCLibPeerConnection::GodotPCO::OnAddStream(rtc::scoped_refptr stream) { } -void WebRTCLibPeer::GodotPCO::OnRemoveStream(rtc::scoped_refptr stream) { +void WebRTCLibPeerConnection::GodotPCO::OnRemoveStream(rtc::scoped_refptr stream) { } -void WebRTCLibPeer::GodotPCO::OnDataChannel(rtc::scoped_refptr data_channel) { +void WebRTCLibPeerConnection::GodotPCO::OnDataChannel(rtc::scoped_refptr data_channel) { + parent->queue_signal("data_channel_received", 1, WebRTCLibDataChannel::new_data_channel(data_channel)); } -void WebRTCLibPeer::GodotPCO::OnRenegotiationNeeded() { +void WebRTCLibPeerConnection::GodotPCO::OnRenegotiationNeeded() { } -void WebRTCLibPeer::GodotPCO::OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) { +void WebRTCLibPeerConnection::GodotPCO::OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) { } -void WebRTCLibPeer::GodotPCO::OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) { +void WebRTCLibPeerConnection::GodotPCO::OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) { } -void WebRTCLibPeer::GodotPCO::OnIceCandidate(const webrtc::IceCandidateInterface *candidate) { +void WebRTCLibPeerConnection::GodotPCO::OnIceCandidate(const webrtc::IceCandidateInterface *candidate) { // Serialize the candidate and send it to the remote peer: godot::Dictionary candidateSDP; @@ -38,7 +40,7 @@ void WebRTCLibPeer::GodotPCO::OnIceCandidate(const webrtc::IceCandidateInterface candidate->ToString(&sdp); godot::String candidateSdpName = sdp.c_str(); - parent->queue_signal("new_ice_candidate", + parent->queue_signal("ice_candidate_created", 3, candidateSdpMidName, candidateSdpMlineIndexName, -- cgit v1.2.3