From fa09e6743d06423128b54f195ae5cdd54f7f3a5a Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 20 May 2017 11:10:05 -0700 Subject: [PATCH] UI: Remove whitespace from end of autconfig stream key Because ?bandwidthtest is being appended to the end, it would bypass normal whitespace removal, causing the stream key to fail. --- UI/window-basic-auto-config-test.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/UI/window-basic-auto-config-test.cpp b/UI/window-basic-auto-config-test.cpp index 4aa5f847f..f18c8656b 100644 --- a/UI/window-basic-auto-config-test.cpp +++ b/UI/window-basic-auto-config-test.cpp @@ -146,6 +146,17 @@ void AutoConfigTestPage::GetServers(std::vector &servers) obs_properties_destroy(ppts); } +static inline void string_depad_key(string &key) +{ + while (!key.empty()) { + char ch = key.back(); + if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') + key.pop_back(); + else + break; + } +} + void AutoConfigTestPage::TestBandwidthThread() { bool connected = false; @@ -205,8 +216,10 @@ void AutoConfigTestPage::TestBandwidthThread() obs_data_release(output_settings); std::string key = wiz->key; - if (wiz->service == AutoConfig::Service::Twitch) + if (wiz->service == AutoConfig::Service::Twitch) { + string_depad_key(key); key += "?bandwidthtest"; + } obs_data_set_string(service_settings, "service", wiz->serviceName.c_str());