diff options
author | Brandon Makin <bmicmak@gmail.com> | 2018-08-12 22:47:37 -0700 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2019-03-08 15:10:08 +0100 |
commit | 34fd1f8caa847d75ff7d5c6e3b8619b494608629 (patch) | |
tree | d91f06930c66014b19bea7fd4526736b69a676f5 /src/GodotDataChannelObserver.cpp | |
parent | a44a5af115871b5be4dcfb05a421046a25ba5d73 (diff) | |
download | fork-godot-webrtc-native-34fd1f8caa847d75ff7d5c6e3b8619b494608629.tar.gz fork-godot-webrtc-native-34fd1f8caa847d75ff7d5c6e3b8619b494608629.tar.bz2 fork-godot-webrtc-native-34fd1f8caa847d75ff7d5c6e3b8619b494608629.zip |
Import GSoC work to WebRTC GDNative implementation
Diffstat (limited to 'src/GodotDataChannelObserver.cpp')
-rw-r--r-- | src/GodotDataChannelObserver.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/GodotDataChannelObserver.cpp b/src/GodotDataChannelObserver.cpp new file mode 100644 index 0000000..081c868 --- /dev/null +++ b/src/GodotDataChannelObserver.cpp @@ -0,0 +1,19 @@ +#include "WebRTCPeer.hpp" + +using namespace godot_webrtc; + +WebRTCPeer::GodotDCO::GodotDCO(WebRTCPeer *parent) { + this->parent = parent; +} + +void WebRTCPeer::GodotDCO::OnMessage(const webrtc::DataBuffer &buffer) { + const uint8_t *data = buffer.data.data<uint8_t>(); + uint8_t *memory_controlled_buffer = new uint8_t[buffer.data.size()]; + + std::copy(data, data + buffer.data.size(), memory_controlled_buffer); + parent->queue_packet(memory_controlled_buffer, buffer.data.size()); +}; + +void WebRTCPeer::GodotDCO::OnStateChange(){}; + +void WebRTCPeer::GodotDCO::OnBufferedAmountChange(uint64_t previous_amount){}; |