Compare commits

..

10 Commits

Author SHA1 Message Date
Fabio Alessandrelli
822e0532c2 Merge pull request #60 from Faless/bump/alpha16
Update to Godot alpha16
2022-09-11 18:26:08 +02:00
Fabio Alessandrelli
d8cbd14a28 Disable android 32 bits builds. 2022-09-11 15:34:08 +02:00
Fabio Alessandrelli
6e52fce986 Update sources to alpha16 2022-09-11 15:34:08 +02:00
Fabio Alessandrelli
a93af67d75 [godot-cpp] Bump to alpha16. 2022-09-11 14:48:51 +02:00
Fabio Alessandrelli
22ee6435a1 Update to libdatachannel 0.17.10+git. 2022-09-11 14:48:51 +02:00
Fabio Alessandrelli
b5d8a72ef8 Update to OpenSSL 3.0.5 2022-09-11 14:48:51 +02:00
Fabio Alessandrelli
2ad1bf1716 Merge pull request #57 from Faless/bump/4.0_alpha11
Bump godot-cpp to alpha11.
2022-07-06 13:24:04 +02:00
Fabio Alessandrelli
e683c79938 Bump godot-cpp to alpha11. 2022-07-06 11:45:03 +02:00
Fabio Alessandrelli
426ca6cc8e Merge pull request #56 from Faless/fix/write_mode
Fix default data channel write mode to binary.
2022-06-19 13:48:20 +02:00
Fabio Alessandrelli
9b53ef3325 Fix default data channel write mode to binary.
It's the engine expected default, and the least surprising for the users
since it allows any data to be sent, while text mode requires valid UTF.
2022-06-19 12:18:49 +02:00
15 changed files with 70 additions and 93 deletions

View File

@@ -37,21 +37,11 @@ jobs:
matrix: matrix:
include: include:
# Android # Android
- platform: android
arch: 'x86_32'
gdnative_flags: 'android_arch=x86'
sconsflags: ''
os: 'ubuntu-20.04'
- platform: android - platform: android
arch: 'x86_64' arch: 'x86_64'
gdnative_flags: 'android_arch=x86_64' gdnative_flags: 'android_arch=x86_64'
sconsflags: '' sconsflags: ''
os: 'ubuntu-20.04' os: 'ubuntu-20.04'
- platform: android
arch: 'arm32'
gdnative_flags: 'android_arch=armv7'
sconsflags: ''
os: 'ubuntu-20.04'
- platform: android - platform: android
arch: 'arm64' arch: 'arm64'
gdnative_flags: 'android_arch=arm64v8' gdnative_flags: 'android_arch=arm64v8'
@@ -84,12 +74,12 @@ jobs:
os: 'ubuntu-20.04' os: 'ubuntu-20.04'
# macOS # macOS
- platform: osx - platform: macos
arch: 'x86_64' arch: 'x86_64'
gdnative_flags: 'macos_arch=x86_64 bits=64' gdnative_flags: 'macos_arch=x86_64 bits=64'
sconsflags: '' sconsflags: ''
os: 'macos-11' os: 'macos-11'
- platform: osx - platform: macos
gdnative_flags: 'macos_arch=arm64 bits=64' gdnative_flags: 'macos_arch=arm64 bits=64'
arch: 'arm64' arch: 'arm64'
sconsflags: '' sconsflags: ''

View File

@@ -23,6 +23,9 @@ opts.Add(EnumVariable("godot_version", "The Godot target version", "4", ["3", "4
opts.Update(env) opts.Update(env)
if env["godot_version"] == "3": if env["godot_version"] == "3":
if "platform" in ARGUMENTS and ARGUMENTS["platform"] == "macos":
ARGUMENTS["platform"] = "osx" # compatibility with old osx name
env = SConscript("godot-cpp-3.x/SConstruct") env = SConscript("godot-cpp-3.x/SConstruct")
# Patch base env # Patch base env
@@ -41,6 +44,10 @@ if env["godot_version"] == "3":
if env["platform"] == "windows" and env["use_mingw"]: if env["platform"] == "windows" and env["use_mingw"]:
env.Append(LINKFLAGS=["-static-libgcc"]) env.Append(LINKFLAGS=["-static-libgcc"])
if env["platform"] == "osx":
env["platform"] = "macos" # compatibility with old osx name
ARGUMENTS["platform"] = "macos"
# Normalize suffix # Normalize suffix
if env["platform"] in ["windows", "linux"]: if env["platform"] in ["windows", "linux"]:
env["arch"] = "x86_32" if env["bits"] == "32" else "x86_64" env["arch"] = "x86_32" if env["bits"] == "32" else "x86_64"
@@ -60,12 +67,8 @@ if env["godot_version"] == "3":
}[env["android_arch"]] }[env["android_arch"]]
env["arch_suffix"] = env["arch"] env["arch_suffix"] = env["arch"]
else: else:
env = SConscript("godot-cpp/SConstruct") ARGUMENTS["ios_min_version"] = "11.0"
replace_flags(env["CCFLAGS"], { env = SConscript("godot-cpp/SConstruct").Clone()
"-mios-simulator-version-min=10.0": "-mios-simulator-version-min=11.0",
"-miphoneos-version-min=10.0": "-miphoneos-version-min=11.0",
})
env = env.Clone()
# Patch mingw SHLIBSUFFIX. # Patch mingw SHLIBSUFFIX.
if env["platform"] == "windows" and env["use_mingw"]: if env["platform"] == "windows" and env["use_mingw"]:

View File

@@ -88,7 +88,7 @@ def ssl_action(target, source, env):
ssl_env.PrependENVPath("PATH", os.path.dirname(env["CC"])) ssl_env.PrependENVPath("PATH", os.path.dirname(env["CC"]))
ssl_env["ENV"]["ANDROID_NDK_ROOT"] = os.environ.get("ANDROID_NDK_ROOT", "") ssl_env["ENV"]["ANDROID_NDK_ROOT"] = os.environ.get("ANDROID_NDK_ROOT", "")
elif env["platform"] == "osx": elif env["platform"] == "macos":
if env["arch"] == "x86_64": if env["arch"] == "x86_64":
args.extend(["darwin64-x86_64"]) args.extend(["darwin64-x86_64"])
elif env["arch"] == "arm64": elif env["arch"] == "arm64":
@@ -191,7 +191,7 @@ def rtc_action(target, source, env):
"-DCMAKE_C_FLAGS=-m64", "-DCMAKE_C_FLAGS=-m64",
"-DCMAKE_CXX_FLAGS=-m64" "-DCMAKE_CXX_FLAGS=-m64"
]) ])
elif env["platform"] == "osx": elif env["platform"] == "macos":
if env["macos_deployment_target"] != "default": if env["macos_deployment_target"] != "default":
args.extend(["-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % env["macos_deployment_target"]]) args.extend(["-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % env["macos_deployment_target"]])
if env["arch"] == "x86_64": if env["arch"] == "x86_64":

2
deps/openssl vendored

View File

@@ -11,8 +11,6 @@ osx.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.osx.{TARGET}.arm64.dylib
windows.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_64.dll" windows.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_64.dll"
windows.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_32.dll" windows.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.windows.{TARGET}.x86_32.dll"
android.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm64.so" android.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm64.so"
android.arm32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm32.so"
android.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_64.so" android.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_64.so"
android.x86_32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_32.so"
ios.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.arm64.dylib" ios.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.arm64.dylib"
ios.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.x86_64.simulator.dylib" ios.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.x86_64.simulator.dylib"

View File

@@ -11,10 +11,8 @@ entry/X11.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64
entry/X11.32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_32.so" entry/X11.32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_32.so"
entry/Server.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64.so" entry/Server.64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_64.so"
entry/Server.32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_32.so" entry/Server.32 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.linux.{TARGET}.x86_32.so"
entry/Android.armeabi-v7a = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm32.so"
entry/Android.arm64-v8a = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm64.so" entry/Android.arm64-v8a = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.arm64.so"
entry/Android.x64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_64.so" entry/Android.x64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_64.so"
entry/Android.x86 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.android.{TARGET}.x86_32.so"
entry/iOS.armv7 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.armv32.dylib" entry/iOS.armv7 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.armv32.dylib"
entry/iOS.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.arm64.dylib" entry/iOS.arm64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.arm64.dylib"
entry/iOS.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.x86_64.simulator.dylib" entry/iOS.x86_64 = "res://{GDNATIVE_PATH}/lib/libwebrtc_native.ios.{TARGET}.x86_64.simulator.dylib"

View File

@@ -33,10 +33,10 @@
#ifdef GDNATIVE_WEBRTC #ifdef GDNATIVE_WEBRTC
#include "GDNativeLibrary.hpp" #include "GDNativeLibrary.hpp"
#include "NativeScript.hpp" #include "NativeScript.hpp"
#define ERR_UNAVAILABLE GODOT_ERR_UNAVAILABLE #define ERR_UNAVAILABLE Error::ERR_UNAVAILABLE
#define FAILED GODOT_FAILED #define FAILED Error::FAILED
#define ERR_INVALID_PARAMETER GODOT_ERR_INVALID_PARAMETER #define ERR_INVALID_PARAMETER Error::ERR_INVALID_PARAMETER
#define OK GODOT_OK #define OK Error::OK
#endif #endif
#include <stdio.h> #include <stdio.h>
@@ -108,12 +108,12 @@ void WebRTCLibDataChannel::queue_packet(const uint8_t *data, uint32_t size, bool
mutex->unlock(); 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); 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; return write_mode;
} }
@@ -121,7 +121,7 @@ bool WebRTCLibDataChannel::_was_string_packet() const {
return current_packet.second; 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); ERR_FAIL_COND_V(!channel, STATE_CLOSED);
return channel_state; return channel_state;
} }
@@ -166,7 +166,7 @@ int64_t WebRTCLibDataChannel::_get_buffered_amount() const {
return channel->bufferedAmount(); return channel->bufferedAmount();
} }
int64_t WebRTCLibDataChannel::_poll() { Error WebRTCLibDataChannel::_poll() {
return OK; return OK;
} }
@@ -177,7 +177,7 @@ void WebRTCLibDataChannel::_close() try {
} catch (...) { } 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); ERR_FAIL_COND_V(packet_queue.empty(), ERR_UNAVAILABLE);
mutex->lock(); mutex->lock();
@@ -191,10 +191,10 @@ int64_t WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_l
mutex->unlock(); 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, FAILED);
ERR_FAIL_COND_V(channel->isClosed(), FAILED); ERR_FAIL_COND_V(channel->isClosed(), FAILED);
if (write_mode == WRITE_MODE_TEXT) { if (write_mode == WRITE_MODE_TEXT) {

View File

@@ -40,6 +40,7 @@
#define GDCLASS(arg1, arg2) GODOT_CLASS(arg1, arg2) #define GDCLASS(arg1, arg2) GODOT_CLASS(arg1, arg2)
#endif #endif
#else #else
#include <godot_cpp/classes/global_constants_binds.hpp>
#include <godot_cpp/classes/web_rtc_data_channel_extension.hpp> #include <godot_cpp/classes/web_rtc_data_channel_extension.hpp>
#endif #endif
@@ -61,7 +62,7 @@ private:
QueuedPacket current_packet; QueuedPacket current_packet;
std::shared_ptr<rtc::DataChannel> channel = nullptr; std::shared_ptr<rtc::DataChannel> channel = nullptr;
WriteMode write_mode = WRITE_MODE_TEXT; WriteMode write_mode = WRITE_MODE_BINARY;
ChannelState channel_state = STATE_CONNECTING; ChannelState channel_state = STATE_CONNECTING;
bool negotiated = false; bool negotiated = false;
@@ -75,20 +76,20 @@ public:
static WebRTCLibDataChannel *new_data_channel(std::shared_ptr<rtc::DataChannel> p_channel, bool p_negotiated); static WebRTCLibDataChannel *new_data_channel(std::shared_ptr<rtc::DataChannel> p_channel, bool p_negotiated);
/* PacketPeer */ /* PacketPeer */
virtual int64_t _get_packet(const uint8_t **r_buffer, int32_t *r_len) override; virtual godot::Error _get_packet(const uint8_t **r_buffer, int32_t *r_len) override;
virtual int64_t _put_packet(const uint8_t *p_buffer, int64_t p_len) override; virtual godot::Error _put_packet(const uint8_t *p_buffer, int64_t p_len) override;
virtual int64_t _get_available_packet_count() const override; virtual int64_t _get_available_packet_count() const override;
virtual int64_t _get_max_packet_size() const override; virtual int64_t _get_max_packet_size() const override;
/* WebRTCDataChannel */ /* WebRTCDataChannel */
int64_t _poll() override; godot::Error _poll() override;
void _close() override; void _close() override;
void _set_write_mode(int64_t p_mode) override; void _set_write_mode(WriteMode p_mode) override;
int64_t _get_write_mode() const override; WriteMode _get_write_mode() const override;
bool _was_string_packet() const override; bool _was_string_packet() const override;
int64_t _get_ready_state() const override; ChannelState _get_ready_state() const override;
godot::String _get_label() const override; godot::String _get_label() const override;
bool _is_ordered() const override; bool _is_ordered() const override;
int64_t _get_id() const override; int64_t _get_id() const override;

View File

@@ -35,24 +35,10 @@ using namespace godot;
using namespace godot_webrtc; using namespace godot_webrtc;
#ifdef GDNATIVE_WEBRTC #ifdef GDNATIVE_WEBRTC
struct CastableError { #define OK Error::OK
godot::Error err_enum; #define FAILED Error::FAILED
int64_t err_int; #define ERR_UNCONFIGURED Error::ERR_UNCONFIGURED
#define ERR_INVALID_PARAMETER Error::ERR_INVALID_PARAMETER
operator int64_t() { return err_int; }
operator godot::Error() { return err_enum; }
CastableError(godot::Error p_enum, int64_t p_int) {
err_enum = p_enum;
err_int = p_int;
}
};
#define MKERR(m_err) CastableError(godot::Error::m_err, GODOT_##m_err)
#define OK MKERR(OK)
#define FAILED MKERR(FAILED)
#define ERR_UNCONFIGURED MKERR(ERR_UNCONFIGURED)
#define ERR_UNAVAILABLE MKERR(ERR_UNAVAILABLE)
#define ERR_INVALID_PARAMETER MKERR(ERR_INVALID_PARAMETER)
#define ERR_BUG MKERR(ERR_BUG)
#endif #endif
void WebRTCLibPeerConnection::initialize_signaling() { void WebRTCLibPeerConnection::initialize_signaling() {
@@ -124,7 +110,7 @@ Error WebRTCLibPeerConnection::_parse_channel_config(rtc::DataChannelInit &r_con
return OK; return OK;
} }
int64_t WebRTCLibPeerConnection::_get_connection_state() const { WebRTCPeerConnection::ConnectionState WebRTCLibPeerConnection::_get_connection_state() const {
ERR_FAIL_COND_V(peer_connection == nullptr, STATE_CLOSED); ERR_FAIL_COND_V(peer_connection == nullptr, STATE_CLOSED);
rtc::PeerConnection::State state = peer_connection->state(); rtc::PeerConnection::State state = peer_connection->state();
@@ -144,7 +130,7 @@ int64_t WebRTCLibPeerConnection::_get_connection_state() const {
} }
} }
int64_t WebRTCLibPeerConnection::_initialize(const Dictionary &p_config) { Error WebRTCLibPeerConnection::_initialize(const Dictionary &p_config) {
rtc::Configuration config = {}; rtc::Configuration config = {};
if (p_config.has("iceServers") && p_config["iceServers"].get_type() == Variant::ARRAY) { if (p_config.has("iceServers") && p_config["iceServers"].get_type() == Variant::ARRAY) {
Array servers = p_config["iceServers"]; Array servers = p_config["iceServers"];
@@ -155,7 +141,7 @@ int64_t WebRTCLibPeerConnection::_initialize(const Dictionary &p_config) {
ERR_FAIL_COND_V(err != OK, FAILED); ERR_FAIL_COND_V(err != OK, FAILED);
} }
} }
return (int64_t)_create_pc(config); return _create_pc(config);
} }
Object *WebRTCLibPeerConnection::_create_data_channel(const String &p_channel, const Dictionary &p_channel_config) try { Object *WebRTCLibPeerConnection::_create_data_channel(const String &p_channel, const Dictionary &p_channel_config) try {
@@ -178,7 +164,7 @@ Object *WebRTCLibPeerConnection::_create_data_channel(const String &p_channel, c
ERR_FAIL_V(nullptr); ERR_FAIL_V(nullptr);
} }
int64_t WebRTCLibPeerConnection::_create_offer() try { Error WebRTCLibPeerConnection::_create_offer() try {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED); ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
ERR_FAIL_COND_V(_get_connection_state() != STATE_NEW, FAILED); ERR_FAIL_COND_V(_get_connection_state() != STATE_NEW, FAILED);
peer_connection->setLocalDescription(rtc::Description::Type::Offer); peer_connection->setLocalDescription(rtc::Description::Type::Offer);
@@ -188,7 +174,7 @@ int64_t WebRTCLibPeerConnection::_create_offer() try {
ERR_FAIL_V(FAILED); ERR_FAIL_V(FAILED);
} }
int64_t WebRTCLibPeerConnection::_set_remote_description(const String &p_type, const String &p_sdp) try { Error WebRTCLibPeerConnection::_set_remote_description(const String &p_type, const String &p_sdp) try {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED); ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
std::string sdp(p_sdp.utf8().get_data()); std::string sdp(p_sdp.utf8().get_data());
std::string type(p_type.utf8().get_data()); std::string type(p_type.utf8().get_data());
@@ -204,7 +190,7 @@ int64_t WebRTCLibPeerConnection::_set_remote_description(const String &p_type, c
ERR_FAIL_V(FAILED); ERR_FAIL_V(FAILED);
} }
int64_t WebRTCLibPeerConnection::_set_local_description(const String &p_type, const String &p_sdp) { Error WebRTCLibPeerConnection::_set_local_description(const String &p_type, const String &p_sdp) {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED); ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
// XXX Library quirk. It doesn't seem possible to create offers/answers without setting the local description. // XXX Library quirk. It doesn't seem possible to create offers/answers without setting the local description.
// Ignore this call for now to avoid crash (it's already set automatically!). // Ignore this call for now to avoid crash (it's already set automatically!).
@@ -212,7 +198,7 @@ int64_t WebRTCLibPeerConnection::_set_local_description(const String &p_type, co
return OK; return OK;
} }
int64_t WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int64_t sdpMlineIndexName, const String &sdpName) try { Error WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int64_t sdpMlineIndexName, const String &sdpName) try {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED); ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
rtc::Candidate candidate(sdpName.utf8().get_data(), sdpMidName.utf8().get_data()); rtc::Candidate candidate(sdpName.utf8().get_data(), sdpMidName.utf8().get_data());
peer_connection->addRemoteCandidate(candidate); peer_connection->addRemoteCandidate(candidate);
@@ -222,7 +208,7 @@ int64_t WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, in
ERR_FAIL_V(FAILED); ERR_FAIL_V(FAILED);
} }
int64_t WebRTCLibPeerConnection::_poll() { Error WebRTCLibPeerConnection::_poll() {
ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED); ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED);
while (!signal_queue.empty()) { while (!signal_queue.empty()) {

View File

@@ -40,6 +40,7 @@
#define GDCLASS(arg1, arg2) GODOT_CLASS(arg1, arg2) #define GDCLASS(arg1, arg2) GODOT_CLASS(arg1, arg2)
#endif #endif
#else #else
#include <godot_cpp/classes/global_constants_binds.hpp>
#include <godot_cpp/classes/web_rtc_peer_connection_extension.hpp> #include <godot_cpp/classes/web_rtc_peer_connection_extension.hpp>
#endif #endif
@@ -71,15 +72,15 @@ public:
void _init(); void _init();
int64_t _get_connection_state() const override; ConnectionState _get_connection_state() const override;
int64_t _initialize(const godot::Dictionary &p_config) override; godot::Error _initialize(const godot::Dictionary &p_config) override;
godot::Object *_create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) override; godot::Object *_create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) override;
int64_t _create_offer() override; godot::Error _create_offer() override;
int64_t _set_remote_description(const godot::String &type, const godot::String &sdp) override; godot::Error _set_remote_description(const godot::String &type, const godot::String &sdp) override;
int64_t _set_local_description(const godot::String &type, const godot::String &sdp) override; godot::Error _set_local_description(const godot::String &type, const godot::String &sdp) override;
int64_t _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) override; godot::Error _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) override;
int64_t _poll() override; godot::Error _poll() override;
void _close() override; void _close() override;
WebRTCLibPeerConnection(); WebRTCLibPeerConnection();

View File

@@ -72,7 +72,7 @@ godot_int get_max_packet_size_wdc(const void *user) {
} }
void set_write_mode_wdc(void *user, godot_int write_mode) { void set_write_mode_wdc(void *user, godot_int write_mode) {
((WebRTCDataChannelNative *)user)->_set_write_mode(write_mode); ((WebRTCDataChannelNative *)user)->_set_write_mode((godot::WebRTCDataChannel::WriteMode)write_mode);
} }
godot_int get_write_mode_wdc(const void *user) { godot_int get_write_mode_wdc(const void *user) {

View File

@@ -112,11 +112,11 @@ public:
void _init(); void _init();
void register_interface(const godot_net_webrtc_data_channel *interface); void register_interface(const godot_net_webrtc_data_channel *interface);
virtual void _set_write_mode(int64_t mode) = 0; virtual void _set_write_mode(WriteMode mode) = 0;
virtual int64_t _get_write_mode() const = 0; virtual WriteMode _get_write_mode() const = 0;
virtual bool _was_string_packet() const = 0; virtual bool _was_string_packet() const = 0;
virtual int64_t _get_ready_state() const = 0; virtual ChannelState _get_ready_state() const = 0;
virtual godot::String _get_label() const = 0; virtual godot::String _get_label() const = 0;
virtual bool _is_ordered() const = 0; virtual bool _is_ordered() const = 0;
virtual int64_t _get_id() const = 0; virtual int64_t _get_id() const = 0;
@@ -126,12 +126,12 @@ public:
virtual bool _is_negotiated() const = 0; virtual bool _is_negotiated() const = 0;
virtual int64_t _get_buffered_amount() const = 0; virtual int64_t _get_buffered_amount() const = 0;
virtual int64_t _poll() = 0; virtual godot::Error _poll() = 0;
virtual void _close() = 0; virtual void _close() = 0;
/* PacketPeer */ /* PacketPeer */
virtual int64_t _get_packet(const uint8_t **r_buffer, int32_t *r_len) = 0; virtual godot::Error _get_packet(const uint8_t **r_buffer, int32_t *r_len) = 0;
virtual int64_t _put_packet(const uint8_t *p_buffer, int64_t p_len) = 0; virtual godot::Error _put_packet(const uint8_t *p_buffer, int64_t p_len) = 0;
virtual int64_t _get_available_packet_count() const = 0; virtual int64_t _get_available_packet_count() const = 0;
virtual int64_t _get_max_packet_size() const = 0; virtual int64_t _get_max_packet_size() const = 0;

View File

@@ -81,15 +81,15 @@ public:
void _init(); void _init();
void register_interface(const godot_net_webrtc_peer_connection *interface); void register_interface(const godot_net_webrtc_peer_connection *interface);
virtual int64_t _get_connection_state() const = 0; virtual ConnectionState _get_connection_state() const = 0;
virtual int64_t _initialize(const godot::Dictionary &p_config) = 0; virtual godot::Error _initialize(const godot::Dictionary &p_config) = 0;
virtual godot::Object *_create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) = 0; virtual godot::Object *_create_data_channel(const godot::String &p_channel, const godot::Dictionary &p_channel_config) = 0;
virtual int64_t _create_offer() = 0; virtual godot::Error _create_offer() = 0;
virtual int64_t _set_remote_description(const godot::String &type, const godot::String &sdp) = 0; virtual godot::Error _set_remote_description(const godot::String &type, const godot::String &sdp) = 0;
virtual int64_t _set_local_description(const godot::String &type, const godot::String &sdp) = 0; virtual godot::Error _set_local_description(const godot::String &type, const godot::String &sdp) = 0;
virtual int64_t _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) = 0; virtual godot::Error _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) = 0;
virtual int64_t _poll() = 0; virtual godot::Error _poll() = 0;
virtual void _close() = 0; virtual void _close() = 0;
~WebRTCPeerConnectionNative(); ~WebRTCPeerConnectionNative();