summaryrefslogtreecommitdiffstats
path: root/modules/webrtc
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webrtc')
-rw-r--r--modules/webrtc/webrtc_peer_connection.cpp13
-rw-r--r--modules/webrtc/webrtc_peer_connection.h2
2 files changed, 10 insertions, 5 deletions
diff --git a/modules/webrtc/webrtc_peer_connection.cpp b/modules/webrtc/webrtc_peer_connection.cpp
index 0a50b677c4..69be873fcf 100644
--- a/modules/webrtc/webrtc_peer_connection.cpp
+++ b/modules/webrtc/webrtc_peer_connection.cpp
@@ -43,15 +43,20 @@ void WebRTCPeerConnection::set_default_extension(const StringName &p_extension)
default_extension = StringName(p_extension, true);
}
-WebRTCPeerConnection *WebRTCPeerConnection::create() {
+WebRTCPeerConnection *WebRTCPeerConnection::create(bool p_notify_postinitialize) {
#ifdef WEB_ENABLED
- return memnew(WebRTCPeerConnectionJS);
+ return static_cast<WebRTCPeerConnection *>(ClassDB::creator<WebRTCPeerConnectionJS>(p_notify_postinitialize));
#else
if (default_extension == StringName()) {
WARN_PRINT_ONCE("No default WebRTC extension configured.");
- return memnew(WebRTCPeerConnectionExtension);
+ return static_cast<WebRTCPeerConnection *>(ClassDB::creator<WebRTCPeerConnectionExtension>(p_notify_postinitialize));
+ }
+ Object *obj = nullptr;
+ if (p_notify_postinitialize) {
+ obj = ClassDB::instantiate(default_extension);
+ } else {
+ obj = ClassDB::instantiate_without_postinitialization(default_extension);
}
- Object *obj = ClassDB::instantiate(default_extension);
return Object::cast_to<WebRTCPeerConnectionExtension>(obj);
#endif
}
diff --git a/modules/webrtc/webrtc_peer_connection.h b/modules/webrtc/webrtc_peer_connection.h
index 0f79c17519..33c95ccd0f 100644
--- a/modules/webrtc/webrtc_peer_connection.h
+++ b/modules/webrtc/webrtc_peer_connection.h
@@ -85,7 +85,7 @@ public:
virtual Error poll() = 0;
virtual void close() = 0;
- static WebRTCPeerConnection *create();
+ static WebRTCPeerConnection *create(bool p_notify_postinitialize = true);
WebRTCPeerConnection();
~WebRTCPeerConnection();