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.hpp | |
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.hpp')
-rw-r--r-- | src/WebRTCLibPeerConnection.hpp | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/WebRTCLibPeerConnection.hpp b/src/WebRTCLibPeerConnection.hpp index c209cf1..f6a92a7 100644 --- a/src/WebRTCLibPeerConnection.hpp +++ b/src/WebRTCLibPeerConnection.hpp @@ -49,35 +49,46 @@ public: public: WebRTCLibPeerConnection *parent; - GodotPCO(WebRTCLibPeerConnection *parent); - void OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) override; - void OnAddStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override; - void OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override; - void OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override; - void OnRenegotiationNeeded() override; - void OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) override; - void OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) override; + GodotPCO(WebRTCLibPeerConnection *p_parent) { + parent = p_parent; + } void OnIceCandidate(const webrtc::IceCandidateInterface *candidate) override; + + void OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) override {} + void OnAddStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override {} + void OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override {} + void OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override {} + void OnRenegotiationNeeded() override {} + void OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) override {} + void OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) override {} }; /** CreateSessionDescriptionObserver callback functions **/ class GodotCSDO : public webrtc::CreateSessionDescriptionObserver { public: - WebRTCLibPeerConnection *parent; + WebRTCLibPeerConnection *parent = nullptr; - GodotCSDO(WebRTCLibPeerConnection *parent); + GodotCSDO(WebRTCLibPeerConnection *p_parent) { + parent = p_parent; + } void OnSuccess(webrtc::SessionDescriptionInterface *desc) override; - void OnFailure(webrtc::RTCError error) override; + void OnFailure(webrtc::RTCError error) override { + ERR_PRINT(godot::String(error.message())); + } }; /** SetSessionDescriptionObserver callback functions **/ class GodotSSDO : public webrtc::SetSessionDescriptionObserver { public: - WebRTCLibPeerConnection *parent; + WebRTCLibPeerConnection *parent = nullptr; - GodotSSDO(WebRTCLibPeerConnection *parent); - void OnSuccess() override; - void OnFailure(webrtc::RTCError error) override; + GodotSSDO(WebRTCLibPeerConnection *p_parent) { + parent = p_parent; + } + void OnSuccess() override {} + void OnFailure(webrtc::RTCError error) override { + ERR_PRINT(godot::String(error.message())); + } }; class Signal { |