diff --git a/UI/window-basic-auto-config-test.cpp b/UI/window-basic-auto-config-test.cpp index 1bac94c59..e79cc581e 100644 --- a/UI/window-basic-auto-config-test.cpp +++ b/UI/window-basic-auto-config-test.cpp @@ -247,9 +247,17 @@ void AutoConfigTestPage::TestBandwidthThread() /* just use the first server if it only has one alternate server, * or if using Mixer due to its "auto" server */ - if (servers.size() < 3 || wiz->serviceName == "Mixer.com - FTL") + if (servers.size() < 3 || wiz->serviceName == "Mixer.com - FTL") { servers.resize(1); + } else if (wiz->service == AutoConfig::Service::Twitch && + wiz->twitchAuto) { + /* if using Twitch and "Auto" is available, test 3 closest + * server */ + servers.erase(servers.begin() + 1); + servers.resize(3); + } + /* -----------------------------------*/ /* apply service settings */ diff --git a/UI/window-basic-auto-config.cpp b/UI/window-basic-auto-config.cpp index f3d1c4139..d9efa1714 100644 --- a/UI/window-basic-auto-config.cpp +++ b/UI/window-basic-auto-config.cpp @@ -370,6 +370,10 @@ void AutoConfigStreamPage::ServiceChanged() bool testBandwidth = ui->doBandwidthTest->isChecked(); bool custom = ui->streamType->currentIndex() == 1; + /* Test three closest servers if "Auto" is available for Twitch */ + if (service == "Twitch" && wiz->twitchAuto) + regionBased = false; + ui->service->setVisible(!custom); ui->serviceLabel->setVisible(!custom); @@ -565,6 +569,23 @@ AutoConfig::AutoConfig(QWidget *parent) baseResolutionCX = ovi.base_width; baseResolutionCY = ovi.base_height; + /* ----------------------------------------- */ + /* check to see if Twitch's "auto" available */ + + OBSData twitchSettings = obs_data_create(); + obs_data_release(twitchSettings); + + obs_data_set_string(twitchSettings, "service", "Twitch"); + + obs_properties_t *props = obs_get_service_properties("rtmp_common"); + obs_properties_apply_settings(props, twitchSettings); + + obs_property_t *p = obs_properties_get(props, "server"); + const char *first = obs_property_list_item_string(p, 0); + twitchAuto = strcmp(first, "auto") == 0; + + obs_properties_destroy(props); + /* ----------------------------------------- */ /* load service/servers */ diff --git a/UI/window-basic-auto-config.hpp b/UI/window-basic-auto-config.hpp index 214305656..a110d89fa 100644 --- a/UI/window-basic-auto-config.hpp +++ b/UI/window-basic-auto-config.hpp @@ -87,6 +87,7 @@ class AutoConfig : public QWizard { bool customServer = false; bool bandwidthTest = false; bool testRegions = true; + bool twitchAuto = false; bool regionUS = true; bool regionEU = true; bool regionAsia = true;