diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-02-07 23:15:42 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-02-09 15:31:39 +0100 |
commit | 00f952bcf1f886d6bcb58a162e5c157ad26d4945 (patch) | |
tree | 42de960838ce444a1c5ded501e4f8faac3379c7f | |
parent | d7032f7b852e2e0acfc6cc1cdd1a17238529abac (diff) | |
download | fork-godot-webrtc-native-00f952bcf1f886d6bcb58a162e5c157ad26d4945.tar.gz fork-godot-webrtc-native-00f952bcf1f886d6bcb58a162e5c157ad26d4945.tar.bz2 fork-godot-webrtc-native-00f952bcf1f886d6bcb58a162e5c157ad26d4945.zip |
Update to Godot 4.0 rc1.
m--------- | godot-cpp | 0 | ||||
-rw-r--r-- | src/WebRTCLibDataChannel.cpp | 14 | ||||
-rw-r--r-- | src/WebRTCLibDataChannel.hpp | 14 | ||||
-rw-r--r-- | src/WebRTCLibPeerConnection.cpp | 4 | ||||
-rw-r--r-- | src/WebRTCLibPeerConnection.hpp | 4 | ||||
-rw-r--r-- | src/net/WebRTCDataChannelNative.hpp | 14 |
6 files changed, 29 insertions, 21 deletions
diff --git a/godot-cpp b/godot-cpp -Subproject 19091138895d35e1ce69742889b8bfd82be57f1 +Subproject 516fad14e45d341211121832bb3daa172aebd6e diff --git a/src/WebRTCLibDataChannel.cpp b/src/WebRTCLibDataChannel.cpp index d4ded1e..dd51ded 100644 --- a/src/WebRTCLibDataChannel.cpp +++ b/src/WebRTCLibDataChannel.cpp @@ -136,17 +136,17 @@ bool WebRTCLibDataChannel::_is_ordered() const { return channel->reliability().unordered == false; } -int64_t WebRTCLibDataChannel::_get_id() const { +int32_t WebRTCLibDataChannel::_get_id() const { ERR_FAIL_COND_V(!channel, -1); return channel->id().value_or(-1); } -int64_t WebRTCLibDataChannel::_get_max_packet_life_time() const { +int32_t WebRTCLibDataChannel::_get_max_packet_life_time() const { ERR_FAIL_COND_V(!channel, 0); return channel->reliability().type == rtc::Reliability::Type::Timed ? std::get<std::chrono::milliseconds>(channel->reliability().rexmit).count() : -1; } -int64_t WebRTCLibDataChannel::_get_max_retransmits() const { +int32_t WebRTCLibDataChannel::_get_max_retransmits() const { ERR_FAIL_COND_V(!channel, 0); return channel->reliability().type == rtc::Reliability::Type::Rexmit ? std::get<int>(channel->reliability().rexmit) : -1; } @@ -161,7 +161,7 @@ bool WebRTCLibDataChannel::_is_negotiated() const { return negotiated; } -int64_t WebRTCLibDataChannel::_get_buffered_amount() const { +int32_t WebRTCLibDataChannel::_get_buffered_amount() const { ERR_FAIL_COND_V(!channel, 0); return channel->bufferedAmount(); } @@ -194,7 +194,7 @@ Error WebRTCLibDataChannel::_get_packet(const uint8_t **r_buffer, int32_t *r_len return OK; } -Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len) try { +Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int32_t p_len) try { ERR_FAIL_COND_V(!channel, FAILED); ERR_FAIL_COND_V(channel->isClosed(), FAILED); if (write_mode == WRITE_MODE_TEXT) { @@ -212,11 +212,11 @@ Error WebRTCLibDataChannel::_put_packet(const uint8_t *p_buffer, int64_t p_len) ERR_FAIL_V(FAILED); } -int64_t WebRTCLibDataChannel::_get_available_packet_count() const { +int32_t WebRTCLibDataChannel::_get_available_packet_count() const { return packet_queue.size(); } -int64_t WebRTCLibDataChannel::_get_max_packet_size() const { +int32_t WebRTCLibDataChannel::_get_max_packet_size() const { return 16384; // See RFC-8831 section 6.6: https://datatracker.ietf.org/doc/rfc8831/ } diff --git a/src/WebRTCLibDataChannel.hpp b/src/WebRTCLibDataChannel.hpp index 2525002..995c204 100644 --- a/src/WebRTCLibDataChannel.hpp +++ b/src/WebRTCLibDataChannel.hpp @@ -79,9 +79,9 @@ public: /* PacketPeer */ virtual godot::Error _get_packet(const uint8_t **r_buffer, int32_t *r_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_max_packet_size() const override; + virtual godot::Error _put_packet(const uint8_t *p_buffer, int32_t p_len) override; + virtual int32_t _get_available_packet_count() const override; + virtual int32_t _get_max_packet_size() const override; /* WebRTCDataChannel */ godot::Error _poll() override; @@ -94,12 +94,12 @@ public: ChannelState _get_ready_state() const override; godot::String _get_label() const override; bool _is_ordered() const override; - int64_t _get_id() const override; - int64_t _get_max_packet_life_time() const override; - int64_t _get_max_retransmits() const override; + int32_t _get_id() const override; + int32_t _get_max_packet_life_time() const override; + int32_t _get_max_retransmits() const override; godot::String _get_protocol() const override; bool _is_negotiated() const override; - int64_t _get_buffered_amount() const override; + int32_t _get_buffered_amount() const override; WebRTCLibDataChannel(); ~WebRTCLibDataChannel(); diff --git a/src/WebRTCLibPeerConnection.cpp b/src/WebRTCLibPeerConnection.cpp index 6f216e0..0744c9b 100644 --- a/src/WebRTCLibPeerConnection.cpp +++ b/src/WebRTCLibPeerConnection.cpp @@ -234,7 +234,11 @@ Error WebRTCLibPeerConnection::_set_local_description(const String &p_type, cons return OK; } +#ifdef GDNATIVE_WEBRTC Error WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int64_t sdpMlineIndexName, const String &sdpName) try { +#else +Error WebRTCLibPeerConnection::_add_ice_candidate(const String &sdpMidName, int32_t sdpMlineIndexName, const String &sdpName) try { +#endif ERR_FAIL_COND_V(!peer_connection, ERR_UNCONFIGURED); rtc::Candidate candidate(sdpName.utf8().get_data(), sdpMidName.utf8().get_data()); peer_connection->addRemoteCandidate(candidate); diff --git a/src/WebRTCLibPeerConnection.hpp b/src/WebRTCLibPeerConnection.hpp index 703a59c..4e7af16 100644 --- a/src/WebRTCLibPeerConnection.hpp +++ b/src/WebRTCLibPeerConnection.hpp @@ -83,7 +83,11 @@ public: godot::Error _create_offer() override; godot::Error _set_remote_description(const godot::String &type, const godot::String &sdp) override; godot::Error _set_local_description(const godot::String &type, const godot::String &sdp) override; +#ifdef GDNATIVE_WEBRTC godot::Error _add_ice_candidate(const godot::String &sdpMidName, int64_t sdpMlineIndexName, const godot::String &sdpName) override; +#else + godot::Error _add_ice_candidate(const godot::String &sdpMidName, int32_t sdpMlineIndexName, const godot::String &sdpName) override; +#endif godot::Error _poll() override; void _close() override; diff --git a/src/net/WebRTCDataChannelNative.hpp b/src/net/WebRTCDataChannelNative.hpp index d00929d..9df9706 100644 --- a/src/net/WebRTCDataChannelNative.hpp +++ b/src/net/WebRTCDataChannelNative.hpp @@ -119,21 +119,21 @@ public: virtual ChannelState _get_ready_state() const = 0; virtual godot::String _get_label() const = 0; virtual bool _is_ordered() const = 0; - virtual int64_t _get_id() const = 0; - virtual int64_t _get_max_packet_life_time() const = 0; - virtual int64_t _get_max_retransmits() const = 0; + virtual int32_t _get_id() const = 0; + virtual int32_t _get_max_packet_life_time() const = 0; + virtual int32_t _get_max_retransmits() const = 0; virtual godot::String _get_protocol() const = 0; virtual bool _is_negotiated() const = 0; - virtual int64_t _get_buffered_amount() const = 0; + virtual int32_t _get_buffered_amount() const = 0; virtual godot::Error _poll() = 0; virtual void _close() = 0; /* PacketPeer */ virtual godot::Error _get_packet(const uint8_t **r_buffer, int32_t *r_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_max_packet_size() const = 0; + virtual godot::Error _put_packet(const uint8_t *p_buffer, int32_t p_len) = 0; + virtual int32_t _get_available_packet_count() const = 0; + virtual int32_t _get_max_packet_size() const = 0; ~WebRTCDataChannelNative(); }; |