diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2019-04-21 04:57:53 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2019-05-16 10:32:51 +0200 |
commit | 3e64a42b1492e38bf033041c0eb1212542728cbd (patch) | |
tree | d187f873ecfdace0d127c6bc340ed295edcaa2f1 /src/GodotPeerConnectionObserver.cpp | |
parent | f2cf2e5340c1aa20516aea4863b8f7a46f317bb6 (diff) | |
download | fork-godot-webrtc-native-3e64a42b1492e38bf033041c0eb1212542728cbd.tar.gz fork-godot-webrtc-native-3e64a42b1492e38bf033041c0eb1212542728cbd.tar.bz2 fork-godot-webrtc-native-3e64a42b1492e38bf033041c0eb1212542728cbd.zip |
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.
Diffstat (limited to 'src/GodotPeerConnectionObserver.cpp')
-rw-r--r-- | src/GodotPeerConnectionObserver.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
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<webrtc::MediaStreamInterface> stream) { +void WebRTCLibPeerConnection::GodotPCO::OnAddStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { } -void WebRTCLibPeer::GodotPCO::OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { +void WebRTCLibPeerConnection::GodotPCO::OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { } -void WebRTCLibPeer::GodotPCO::OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) { +void WebRTCLibPeerConnection::GodotPCO::OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> 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, |