mirror of
https://github.com/godotengine/webrtc-native.git
synced 2026-01-01 05:48:15 +03:00
Run clang-format on src/*
This commit is contained in:
@@ -70,7 +70,6 @@ WebRTCLibDataChannel *WebRTCLibDataChannel::new_data_channel(rtc::scoped_refptr<
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
void WebRTCLibDataChannel::bind_channel(rtc::scoped_refptr<webrtc::DataChannelInterface> p_channel) {
|
||||
ERR_FAIL_COND(p_channel.get() == nullptr);
|
||||
|
||||
@@ -150,7 +149,7 @@ godot_error WebRTCLibDataChannel::poll() {
|
||||
}
|
||||
|
||||
void WebRTCLibDataChannel::close() {
|
||||
if(channel.get() != nullptr) {
|
||||
if (channel.get() != nullptr) {
|
||||
channel->Close();
|
||||
channel->UnregisterObserver();
|
||||
}
|
||||
@@ -197,7 +196,8 @@ void WebRTCLibDataChannel::_init() {
|
||||
register_interface(&interface);
|
||||
}
|
||||
|
||||
WebRTCLibDataChannel::WebRTCLibDataChannel() : observer(this) {
|
||||
WebRTCLibDataChannel::WebRTCLibDataChannel() :
|
||||
observer(this) {
|
||||
mutex = new std::mutex;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
#include "api/peer_connection_interface.h" // interface for all things needed from WebRTC
|
||||
#include "media/base/media_engine.h" // needed for CreateModularPeerConnectionFactory
|
||||
|
||||
#include "net/WebRTCDataChannelNative.hpp"
|
||||
#include "PoolArrays.hpp"
|
||||
#include "net/WebRTCDataChannelNative.hpp"
|
||||
#include <mutex>
|
||||
|
||||
namespace godot_webrtc {
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
|
||||
#include "WebRTCLibPeerConnection.hpp"
|
||||
#include "WebRTCDataChannel.hpp"
|
||||
#include "WebRTCDataChannelGDNative.hpp"
|
||||
#include "WebRTCLibPeerConnection.hpp"
|
||||
#include "WebRTCLibDataChannel.hpp"
|
||||
|
||||
using namespace godot_webrtc;
|
||||
@@ -114,7 +114,12 @@ godot_error _parse_ice_server(webrtc::PeerConnectionInterface::RTCConfiguration
|
||||
|
||||
godot_error _parse_channel_config(webrtc::DataChannelInit &r_config, godot::Dictionary p_dict) {
|
||||
godot::Variant v;
|
||||
#define _SET_N(PROP, PNAME, TYPE) if (p_dict.has(#PROP)) { v = p_dict[#PROP]; if(v.get_type() == godot::Variant::TYPE) r_config.PNAME = v; }
|
||||
#define _SET_N(PROP, PNAME, TYPE) \
|
||||
if (p_dict.has(#PROP)) { \
|
||||
v = p_dict[#PROP]; \
|
||||
if (v.get_type() == godot::Variant::TYPE) \
|
||||
r_config.PNAME = v; \
|
||||
}
|
||||
#define _SET(PROP, TYPE) _SET_N(PROP, PROP, TYPE)
|
||||
_SET(negotiated, BOOL);
|
||||
_SET(id, INT);
|
||||
@@ -137,7 +142,7 @@ WebRTCLibPeerConnection::ConnectionState WebRTCLibPeerConnection::get_connection
|
||||
ERR_FAIL_COND_V(peer_connection.get() == nullptr, STATE_CLOSED);
|
||||
|
||||
webrtc::PeerConnectionInterface::IceConnectionState state = peer_connection->ice_connection_state();
|
||||
switch(state) {
|
||||
switch (state) {
|
||||
case webrtc::PeerConnectionInterface::kIceConnectionNew:
|
||||
return STATE_NEW;
|
||||
case webrtc::PeerConnectionInterface::kIceConnectionChecking:
|
||||
@@ -248,7 +253,7 @@ void WebRTCLibPeerConnection::close() {
|
||||
peer_connection->Close();
|
||||
}
|
||||
peer_connection = nullptr;
|
||||
while(!signal_queue.empty()) {
|
||||
while (!signal_queue.empty()) {
|
||||
signal_queue.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ private:
|
||||
godot_error _create_pc(webrtc::PeerConnectionInterface::RTCConfiguration &config);
|
||||
|
||||
static std::unique_ptr<rtc::Thread> signaling_thread;
|
||||
|
||||
public:
|
||||
static void _register_methods();
|
||||
static void initialize_signaling();
|
||||
@@ -127,6 +128,7 @@ private:
|
||||
godot::String method;
|
||||
godot::Variant argv[3];
|
||||
int argc = 0;
|
||||
|
||||
public:
|
||||
Signal(godot::String p_method, int p_argc, const godot::Variant *p_argv) {
|
||||
method = p_method;
|
||||
|
||||
@@ -64,14 +64,14 @@ godot_error create_peer_connection_wp(godot_object *out) {
|
||||
_singleton_api->godot_string_destroy(&s);
|
||||
|
||||
// Bind script to Object
|
||||
const void *args3[] = { (void *)script };
|
||||
const void *args3[] = { (void *)script };
|
||||
_singleton_api->godot_method_bind_ptrcall(_set_script_mb, out, args3, nullptr);
|
||||
|
||||
return GODOT_OK;
|
||||
}
|
||||
|
||||
godot_net_webrtc_library library = {
|
||||
{3, 2},
|
||||
{ 3, 2 },
|
||||
&unregistered,
|
||||
&create_peer_connection_wp,
|
||||
NULL,
|
||||
@@ -102,7 +102,6 @@ extern "C" void GDN_EXPORT godot_gdnative_singleton() {
|
||||
extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) {
|
||||
const godot_gdnative_core_api_struct *api = o->api_struct;
|
||||
for (int i = 0; i < api->num_extensions; i++) {
|
||||
|
||||
if (api->extensions[i]->type != GDNATIVE_EXT_NET)
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user