浏览代码

UI: Add Amazon IVS auto config QoL changes

This doesn't generally make the speedtest work for Amazon IVS, since
most Amazon IVS channels will be disconnected if the bitrate being
sent exceeds the upper limit for that channel.
Ruwen Hahn 1 年之前
父节点
当前提交
adcaf539c9
共有 3 个文件被更改,包括 30 次插入4 次删除
  1. 6 3
      UI/window-basic-auto-config-test.cpp
  2. 22 1
      UI/window-basic-auto-config.cpp
  3. 2 0
      UI/window-basic-auto-config.hpp

+ 6 - 3
UI/window-basic-auto-config-test.cpp

@@ -221,7 +221,8 @@ void AutoConfigTestPage::TestBandwidthThread()
 	OBSDataAutoRelease output_settings = obs_data_create();
 
 	std::string key = wiz->key;
-	if (wiz->service == AutoConfig::Service::Twitch) {
+	if (wiz->service == AutoConfig::Service::Twitch ||
+	    wiz->service == AutoConfig::Service::AmazonIVS) {
 		string_depad_key(key);
 		key += "?bandwidthtest";
 	} else if (wiz->serviceName == "Restream.io" ||
@@ -266,8 +267,10 @@ void AutoConfigTestPage::TestBandwidthThread()
 	    wiz->serviceName == "Nimo TV") {
 		servers.resize(1);
 
-	} else if (wiz->service == AutoConfig::Service::Twitch &&
-		   wiz->twitchAuto) {
+	} else if ((wiz->service == AutoConfig::Service::Twitch &&
+		    wiz->twitchAuto) ||
+		   (wiz->service == AutoConfig::Service::AmazonIVS &&
+		    wiz->amazonIVSAuto)) {
 		/* if using Twitch and "Auto" is available, test 3 closest
 		 * server */
 		servers.erase(servers.begin() + 1);

+ 22 - 1
UI/window-basic-auto-config.cpp

@@ -411,6 +411,8 @@ bool AutoConfigStreamPage::validatePage()
 		else if (IsYouTubeService(wiz->serviceName))
 			wiz->service = AutoConfig::Service::YouTube;
 #endif
+		else if (wiz->serviceName == "Amazon IVS")
+			wiz->service = AutoConfig::Service::AmazonIVS;
 		else
 			wiz->service = AutoConfig::Service::Other;
 	} else {
@@ -498,6 +500,7 @@ bool AutoConfigStreamPage::validatePage()
 
 	if (wiz->service != AutoConfig::Service::Twitch &&
 	    wiz->service != AutoConfig::Service::YouTube &&
+	    wiz->service != AutoConfig::Service::AmazonIVS &&
 	    wiz->bandwidthTest) {
 		QMessageBox::StandardButton button;
 #define WARNING_TEXT(x) QTStr("Basic.AutoConfig.StreamPage.StreamWarning." x)
@@ -774,7 +777,8 @@ void AutoConfigStreamPage::ServiceChanged()
 	reset_service_ui_fields(service);
 
 	/* Test three closest servers if "Auto" is available for Twitch */
-	if (service == "Twitch" && wiz->twitchAuto)
+	if ((service == "Twitch" && wiz->twitchAuto) ||
+	    (service == "Amazon IVS" && wiz->amazonIVSAuto))
 		regionBased = false;
 
 	ui->streamkeyPageLayout->removeWidget(ui->serverLabel);
@@ -1025,6 +1029,7 @@ AutoConfig::AutoConfig(QWidget *parent) : QWizard(parent)
 
 	proc_handler_t *ph = obs_get_proc_handler();
 	proc_handler_call(ph, "twitch_ingests_refresh", &cd);
+	proc_handler_call(ph, "amazon_ivs_ingests_refresh", &cd);
 	calldata_free(&cd);
 
 	OBSBasic *main = reinterpret_cast<OBSBasic *>(parent);
@@ -1068,6 +1073,22 @@ AutoConfig::AutoConfig(QWidget *parent) : QWizard(parent)
 
 	obs_properties_destroy(props);
 
+	/* ----------------------------------------- */
+	/* check to see if Amazon IVS "auto" entries are available */
+
+	OBSDataAutoRelease amazonIVSSettings = obs_data_create();
+
+	obs_data_set_string(amazonIVSSettings, "service", "Amazon IVS");
+
+	props = obs_get_service_properties("rtmp_common");
+	obs_properties_apply_settings(props, amazonIVSSettings);
+
+	p = obs_properties_get(props, "server");
+	first = obs_property_list_item_string(p, 0);
+	amazonIVSAuto = strncmp(first, "auto", 4) == 0;
+
+	obs_properties_destroy(props);
+
 	/* ----------------------------------------- */
 	/* load service/servers                      */
 

+ 2 - 0
UI/window-basic-auto-config.hpp

@@ -40,6 +40,7 @@ class AutoConfig : public QWizard {
 	enum class Service {
 		Twitch,
 		YouTube,
+		AmazonIVS,
 		Other,
 	};
 
@@ -110,6 +111,7 @@ class AutoConfig : public QWizard {
 	bool testMultitrackVideo = false;
 	bool testRegions = true;
 	bool twitchAuto = false;
+	bool amazonIVSAuto = false;
 	bool regionUS = true;
 	bool regionEU = true;
 	bool regionAsia = true;