summaryrefslogtreecommitdiff
path: root/modules/webrtc/webrtc_peer_connection_js.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-07-15 16:20:17 +0200
committerGitHub <noreply@github.com>2021-07-15 16:20:17 +0200
commit9427bf38427da6366118bfd21fbb2f064bc5719d (patch)
treeb59c578509f8cf4af394bf1c9d79646c3b67f879 /modules/webrtc/webrtc_peer_connection_js.cpp
parent64fb4fac89ddc51f35a3e727783f4f40dc9eca8f (diff)
parent9a044d95fc7374e10088bc33abf7909027e02b75 (diff)
Merge pull request #50480 from Faless/js/4.x_ci
Diffstat (limited to 'modules/webrtc/webrtc_peer_connection_js.cpp')
-rw-r--r--modules/webrtc/webrtc_peer_connection_js.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/webrtc/webrtc_peer_connection_js.cpp b/modules/webrtc/webrtc_peer_connection_js.cpp
index 8879f7d6ec..2b63e76358 100644
--- a/modules/webrtc/webrtc_peer_connection_js.cpp
+++ b/modules/webrtc/webrtc_peer_connection_js.cpp
@@ -34,7 +34,6 @@
#include "webrtc_data_channel_js.h"
-#include "core/io/json.h"
#include "emscripten.h"
void WebRTCPeerConnectionJS::_on_ice_candidate(void *p_obj, const char *p_mid_name, int p_mline_idx, const char *p_candidate) {
@@ -100,7 +99,7 @@ Error WebRTCPeerConnectionJS::initialize(Dictionary p_config) {
}
_conn_state = STATE_NEW;
- String config = JSON::print(p_config);
+ String config = Variant(p_config).to_json_string();
_js_id = godot_js_rtc_pc_create(config.utf8().get_data(), this, &_on_connection_state_changed, &_on_ice_candidate, &_on_data_channel);
return _js_id ? OK : FAILED;
}
@@ -108,7 +107,7 @@ Error WebRTCPeerConnectionJS::initialize(Dictionary p_config) {
Ref<WebRTCDataChannel> WebRTCPeerConnectionJS::create_data_channel(String p_channel, Dictionary p_channel_config) {
ERR_FAIL_COND_V(_conn_state != STATE_NEW, nullptr);
- String config = JSON::print(p_channel_config);
+ String config = Variant(p_channel_config).to_json_string();
int id = godot_js_rtc_pc_datachannel_create(_js_id, p_channel.utf8().get_data(), config.utf8().get_data());
ERR_FAIL_COND_V(id == 0, nullptr);
return memnew(WebRTCDataChannelJS(id));