mirror of
https://github.com/godotengine/webrtc-native.git
synced 2026-01-05 02:10:04 +03:00
Compare commits
5 Commits
1.0.0-alph
...
1.0.0-beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1769730ef0 | ||
|
|
04898f2714 | ||
|
|
d7fc6cde3b | ||
|
|
1009e8bb1c | ||
|
|
5fd359f674 |
Submodule godot-cpp updated: 0d7da02dc4...fa4d18f21c
@@ -130,6 +130,42 @@ WebRTCPeerConnection::ConnectionState WebRTCLibPeerConnection::_get_connection_s
|
||||
}
|
||||
}
|
||||
|
||||
WebRTCLibPeerConnection::GatheringState WebRTCLibPeerConnection::_get_gathering_state() const {
|
||||
ERR_FAIL_COND_V(peer_connection == nullptr, GATHERING_STATE_NEW);
|
||||
|
||||
rtc::PeerConnection::GatheringState state = peer_connection->gatheringState();
|
||||
switch (state) {
|
||||
case rtc::PeerConnection::GatheringState::New:
|
||||
return GATHERING_STATE_NEW;
|
||||
case rtc::PeerConnection::GatheringState::InProgress:
|
||||
return GATHERING_STATE_GATHERING;
|
||||
case rtc::PeerConnection::GatheringState::Complete:
|
||||
return GATHERING_STATE_COMPLETE;
|
||||
default:
|
||||
return GATHERING_STATE_NEW;
|
||||
}
|
||||
}
|
||||
|
||||
WebRTCLibPeerConnection::SignalingState WebRTCLibPeerConnection::_get_signaling_state() const {
|
||||
ERR_FAIL_COND_V(peer_connection == nullptr, SIGNALING_STATE_CLOSED);
|
||||
|
||||
rtc::PeerConnection::SignalingState state = peer_connection->signalingState();
|
||||
switch (state) {
|
||||
case rtc::PeerConnection::SignalingState::Stable:
|
||||
return SIGNALING_STATE_STABLE;
|
||||
case rtc::PeerConnection::SignalingState::HaveLocalOffer:
|
||||
return SIGNALING_STATE_HAVE_LOCAL_OFFER;
|
||||
case rtc::PeerConnection::SignalingState::HaveRemoteOffer:
|
||||
return SIGNALING_STATE_HAVE_REMOTE_OFFER;
|
||||
case rtc::PeerConnection::SignalingState::HaveLocalPranswer:
|
||||
return SIGNALING_STATE_HAVE_LOCAL_PRANSWER;
|
||||
case rtc::PeerConnection::SignalingState::HaveRemotePranswer:
|
||||
return SIGNALING_STATE_HAVE_REMOTE_PRANSWER;
|
||||
default:
|
||||
return SIGNALING_STATE_CLOSED;
|
||||
}
|
||||
}
|
||||
|
||||
Error WebRTCLibPeerConnection::_initialize(const Dictionary &p_config) {
|
||||
rtc::Configuration config = {};
|
||||
if (p_config.has("iceServers") && p_config["iceServers"].get_type() == Variant::ARRAY) {
|
||||
|
||||
@@ -73,6 +73,8 @@ public:
|
||||
void _init();
|
||||
|
||||
ConnectionState _get_connection_state() const override;
|
||||
GatheringState _get_gathering_state() const override;
|
||||
SignalingState _get_signaling_state() const 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;
|
||||
|
||||
@@ -75,6 +75,21 @@ protected:
|
||||
};
|
||||
|
||||
public:
|
||||
enum GatheringState {
|
||||
GATHERING_STATE_NEW,
|
||||
GATHERING_STATE_GATHERING,
|
||||
GATHERING_STATE_COMPLETE,
|
||||
};
|
||||
|
||||
enum SignalingState {
|
||||
SIGNALING_STATE_STABLE,
|
||||
SIGNALING_STATE_HAVE_LOCAL_OFFER,
|
||||
SIGNALING_STATE_HAVE_REMOTE_OFFER,
|
||||
SIGNALING_STATE_HAVE_LOCAL_PRANSWER,
|
||||
SIGNALING_STATE_HAVE_REMOTE_PRANSWER,
|
||||
SIGNALING_STATE_CLOSED,
|
||||
};
|
||||
|
||||
static void _register_methods();
|
||||
static const godot_gdnative_ext_net_3_2_api_struct *_net_api;
|
||||
|
||||
@@ -82,6 +97,8 @@ public:
|
||||
void register_interface(const godot_net_webrtc_peer_connection *interface);
|
||||
|
||||
virtual ConnectionState _get_connection_state() const = 0;
|
||||
virtual GatheringState _get_gathering_state() const = 0;
|
||||
virtual SignalingState _get_signaling_state() const = 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;
|
||||
|
||||
Reference in New Issue
Block a user