Skip to content

Commit

Permalink
Merge pull request #87 from Faless/bump/rc1
Browse files Browse the repository at this point in the history
Update to Godot 4.0 rc1.
  • Loading branch information
Faless authored Feb 9, 2023
2 parents d7032f7 + 00f952b commit c6b6f7e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 22 deletions.
14 changes: 7 additions & 7 deletions src/WebRTCLibDataChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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();
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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/
}

Expand Down
14 changes: 7 additions & 7 deletions src/WebRTCLibDataChannel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class WebRTCLibDataChannel : public godot::WebRTCDataChannelExtension {

/* 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;
Expand All @@ -94,12 +94,12 @@ class WebRTCLibDataChannel : public godot::WebRTCDataChannelExtension {
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();
Expand Down
4 changes: 4 additions & 0 deletions src/WebRTCLibPeerConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/WebRTCLibPeerConnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ class WebRTCLibPeerConnection : public godot::WebRTCPeerConnectionExtension {
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;

Expand Down
14 changes: 7 additions & 7 deletions src/net/WebRTCDataChannelNative.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,21 @@ class WebRTCDataChannelNative : public godot::WebRTCDataChannelGDNative {
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();
};
Expand Down

0 comments on commit c6b6f7e

Please sign in to comment.