Selaa lähdekoodia

UI: Test first 3 closest Twitch ingests in auto-config

If auto is available, test the first 3 closest Twitch ingests rather
than using a region-based selection.
jp9000 8 vuotta sitten
vanhempi
sitoutus
8a5cf99aa7

+ 9 - 1
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             */
 

+ 21 - 0
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                      */
 

+ 1 - 0
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;