diff options
| author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-06-09 06:56:06 +0200 |
|---|---|---|
| committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-06-09 07:19:00 +0200 |
| commit | 31d7e22466476865bd8c64895df79b832360fccf (patch) | |
| tree | f6b0aa93a8c5c75585bdd387a7ee15dedbfbb829 /modules/webrtc/webrtc_peer_connection.cpp | |
| parent | 7e0c54e292f2813878d178bbb691a419ed6fb295 (diff) | |
| download | redot-engine-31d7e22466476865bd8c64895df79b832360fccf.tar.gz | |
[WebRTC] Static extension registration.
Diffstat (limited to 'modules/webrtc/webrtc_peer_connection.cpp')
| -rw-r--r-- | modules/webrtc/webrtc_peer_connection.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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); |
