summaryrefslogtreecommitdiff
path: root/src/WebRTCLibDataChannel.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-09-11 18:26:08 +0200
committerGitHub <noreply@github.com>2022-09-11 18:26:08 +0200
commit822e0532c23354c02fcdbdef90dc70236ece6255 (patch)
tree5eebac3b7ac82500601084e883086139bc29b01b /src/WebRTCLibDataChannel.cpp
parent2ad1bf171653c3fb72d8f987b403ab65c9ad6a46 (diff)
parentd8cbd14a28d8c3c526c8ba1759b4052cbfead2c9 (diff)
downloadgodot-webrtc-native-822e0532c23354c02fcdbdef90dc70236ece6255.tar.gz
godot-webrtc-native-822e0532c23354c02fcdbdef90dc70236ece6255.tar.bz2
godot-webrtc-native-822e0532c23354c02fcdbdef90dc70236ece6255.zip
Merge pull request #60 from Faless/bump/alpha16
Update to Godot alpha16
Diffstat (limited to 'src/WebRTCLibDataChannel.cpp')
-rw-r--r--src/WebRTCLibDataChannel.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/WebRTCLibDataChannel.cpp b/src/WebRTCLibDataChannel.cpp
index 5c4ad5d..d4ded1e 100644
--- a/src/WebRTCLibDataChannel.cpp
+++ b/src/WebRTCLibDataChannel.cpp
@@ -33,10 +33,10 @@
#ifdef GDNATIVE_WEBRTC
#include "GDNativeLibrary.hpp"
#include "NativeScript.hpp"
-#define ERR_UNAVAILABLE GODOT_ERR_UNAVAILABLE
-#define FAILED GODOT_FAILED
-#define ERR_INVALID_PARAMETER GODOT_ERR_INVALID_PARAMETER
-#define OK GODOT_OK
+#define ERR_UNAVAILABLE Error::ERR_UNAVAILABLE
+#define FAILED Error::FAILED
+#define ERR_INVALID_PARAMETER Error::ERR_INVALID_PARAMETER
+#define OK Error::OK
#endif
#include <stdio.h>
@@ -108,12 +108,12 @@ void WebRTCLibDataChannel::queue_packet(const uint8_t *data, uint32_t size, bool
mutex->unlock();
}
-void WebRTCLibDataChannel::_set_write_mode(int64_t p_mode) {
+void WebRTCLibDataChannel::_set_write_mode(WriteMode p_mode) {
ERR_FAIL_COND(p_mode != WRITE_MODE_TEXT && p_mode != WRITE_MODE_BINARY);
- write_mode = (WriteMode)p_mode;
+ write_mode = p_mode;
}
-int64_t WebRTCLibDataChannel::_get_write_mode() const {
+WebRTCDataChannel::WriteMode WebRTCLibDataChannel::_get_write_mode() const {
return write_mode;
}
@@ -121,7 +121,7 @@ bool WebRTCLibDataChannel::_was_string_packet() const {
return current_packet.second;
}
-int64_t WebRTCLibDataChannel::_get_ready_state() const {
+WebRTCDataChannel::ChannelState WebRTCLibDataChannel::_get_ready_state() const {
ERR_FAIL_COND_V(!channel, STATE_CLOSED);
return channel_state;
}
@@ -166,7 +166,7 @@ int64_t WebRTCLibDataChannel::_get_buffered_amount() const {
return channel->bufferedAmount();
}
-int64_t WebRTCLibDataChannel::_poll() {
+Error WebRTCLibDataChannel::_poll() {
return OK;
}
@@ -177,7 +177,7 @@ void WebRTCLibDataChannel::_close() try {
} catch (...) {
}
-int64_t WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_len) {
+Error WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_len) {
ERR_FAIL_COND_V(packet_queue.empty(), ERR_UNAVAILABLE);
mutex->lock();
@@ -191,10 +191,10 @@ int64_t WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_l
mutex->unlock();
- return 0;
+ return OK;
}
-int64_t WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len) try {
+Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len) try {
ERR_FAIL_COND_V(!channel, FAILED);
ERR_FAIL_COND_V(channel->isClosed(), FAILED);
if (write_mode == WRITE_MODE_TEXT) {