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.
master
jp9000 2017-05-20 11:10:05 -07:00
parent 4217f273a6
commit fa09e6743d
1 changed files with 14 additions and 1 deletions

View File

@ -146,6 +146,17 @@ void AutoConfigTestPage::GetServers(std::vector<ServerInfo> &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());