From 31d7e22466476865bd8c64895df79b832360fccf Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 9 Jun 2022 06:56:06 +0200 Subject: [WebRTC] Static extension registration. --- modules/webrtc/webrtc_peer_connection.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'modules/webrtc/webrtc_peer_connection.cpp') diff --git a/modules/webrtc/webrtc_peer_connection.cpp b/modules/webrtc/webrtc_peer_connection.cpp index 7fdf26d3cd..75716017d7 100644 --- a/modules/webrtc/webrtc_peer_connection.cpp +++ b/modules/webrtc/webrtc_peer_connection.cpp @@ -32,13 +32,14 @@ #ifdef JAVASCRIPT_ENABLED #include "webrtc_peer_connection_js.h" -#else -#include "webrtc_peer_connection_extension.h" #endif +#include "webrtc_peer_connection_extension.h" + StringName WebRTCPeerConnection::default_extension; void WebRTCPeerConnection::set_default_extension(const StringName &p_extension) { + ERR_FAIL_COND_MSG(!ClassDB::is_parent_class(p_extension, WebRTCPeerConnectionExtension::get_class_static()), vformat("Can't make %s the default WebRTC extension since it does not extend WebRTCPeerConnectionExtension.", p_extension)); default_extension = p_extension; } @@ -56,6 +57,8 @@ WebRTCPeerConnection *WebRTCPeerConnection::create() { } void WebRTCPeerConnection::_bind_methods() { + ClassDB::bind_static_method(get_class_static(), D_METHOD("set_default_extension", "extension_class"), &WebRTCPeerConnectionExtension::set_default_extension); + ClassDB::bind_method(D_METHOD("initialize", "configuration"), &WebRTCPeerConnection::initialize, DEFVAL(Dictionary())); ClassDB::bind_method(D_METHOD("create_data_channel", "label", "options"), &WebRTCPeerConnection::create_data_channel, DEFVAL(Dictionary())); ClassDB::bind_method(D_METHOD("create_offer"), &WebRTCPeerConnection::create_offer); -- cgit v1.2.3