summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authortrilene <trilene@runbox.com>2020-07-13 19:16:28 -0400
committertrilene <trilene@runbox.com>2020-07-13 19:16:28 -0400
commite85652e7e7f10f7dfd9b70b0ef66c5699fd94597 (patch)
tree1cf9b817726217b7105a16a313ecb06c1df9a4f2 /src
parentMerge remote-tracking branch 'upstream/master' into voip (diff)
downloadnheko-e85652e7e7f10f7dfd9b70b0ef66c5699fd94597.tar.xz
Fix percent-encoding of TURN server URI
Diffstat (limited to 'src')
-rw-r--r--src/CallManager.cpp11
-rw-r--r--src/WebRTCSession.cpp11
2 files changed, 11 insertions, 11 deletions
diff --git a/src/CallManager.cpp b/src/CallManager.cpp

index 67aabced..b2236290 100644 --- a/src/CallManager.cpp +++ b/src/CallManager.cpp
@@ -274,7 +274,8 @@ CallManager::retrieveTurnServer() void CallManager::setTurnServers() { - // gstreamer expects (percent-encoded): turn(s)://username:password@host:port?transport=udp(tcp) + // gstreamer expects: turn(s)://username:password@host:port?transport=udp(tcp) + // where username and password are percent-encoded std::vector<std::string> uris; for (const auto &uri : turnServer_.uris) { if (auto c = uri.find(':'); c == std::string::npos) { @@ -287,9 +288,11 @@ CallManager::setTurnServers() nhlog::ui()->error("Invalid TURN server uri: {}", uri); continue; } - std::string res = scheme + "://" + turnServer_.username + ":" + turnServer_.password - + "@" + std::string(uri, ++c); - QString encodedUri = QUrl::toPercentEncoding(QString::fromStdString(res)); + + QString encodedUri = QString::fromStdString(scheme) + "://" + + QUrl::toPercentEncoding(QString::fromStdString(turnServer_.username)) + ":" + + QUrl::toPercentEncoding(QString::fromStdString(turnServer_.password)) + "@" + + QString::fromStdString(std::string(uri, ++c)); uris.push_back(encodedUri.toStdString()); } } diff --git a/src/WebRTCSession.cpp b/src/WebRTCSession.cpp
index ac707243..86277f08 100644 --- a/src/WebRTCSession.cpp +++ b/src/WebRTCSession.cpp
@@ -143,7 +143,7 @@ WebRTCSession::startPipeline(int opusPayloadType) webrtc_ = gst_bin_get_by_name(GST_BIN(pipe_), "webrtcbin"); if (!stunServer_.empty()) { - nhlog::ui()->info("WebRTC: Setting stun server: {}", stunServer_); + nhlog::ui()->info("WebRTC: Setting STUN server: {}", stunServer_); g_object_set(webrtc_, "stun-server", stunServer_.c_str(), nullptr); } addTurnServers(); @@ -265,12 +265,9 @@ WebRTCSession::addTurnServers() return; for (const auto &uri : turnServers_) { - gboolean res; - g_signal_emit_by_name(webrtc_, "add-turn-server", uri.c_str(), (gpointer)(&res)); - if (res) - nhlog::ui()->info("WebRTC: Set TURN server: {}", uri); - else - nhlog::ui()->error("WebRTC: Failed to set TURN server: {}", uri); + nhlog::ui()->info("WebRTC: Setting TURN server: {}", uri); + gboolean udata; + g_signal_emit_by_name(webrtc_, "add-turn-server", uri.c_str(), (gpointer)(&udata)); } }