summaryrefslogtreecommitdiff
path: root/src/GodotDataChannelObserver.cpp
blob: 7a6cf96d127d40990eeb3d0f754cbab58d5943d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "WebRTCLibPeer.hpp"

using namespace godot_webrtc;

WebRTCLibPeer::GodotDCO::GodotDCO(WebRTCLibPeer *parent) {
	this->parent = parent;
}

void WebRTCLibPeer::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 WebRTCLibPeer::GodotDCO::OnStateChange(){};

void WebRTCLibPeer::GodotDCO::OnBufferedAmountChange(uint64_t previous_amount){};