From adcaf539c9fc6dfca094211946de18b5b5a3b582 Mon Sep 17 00:00:00 2001 From: Ruwen Hahn Date: Thu, 11 Apr 2024 14:27:44 +0200 Subject: [PATCH] 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. --- UI/window-basic-auto-config-test.cpp | 9 ++++++--- UI/window-basic-auto-config.cpp | 23 ++++++++++++++++++++++- UI/window-basic-auto-config.hpp | 2 ++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/UI/window-basic-auto-config-test.cpp b/UI/window-basic-auto-config-test.cpp index b242e1d94..b1962d455 100644 --- a/UI/window-basic-auto-config-test.cpp +++ b/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); diff --git a/UI/window-basic-auto-config.cpp b/UI/window-basic-auto-config.cpp index 01c356702..20f2705ef 100644 --- a/UI/window-basic-auto-config.cpp +++ b/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(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 */ diff --git a/UI/window-basic-auto-config.hpp b/UI/window-basic-auto-config.hpp index 2f93c540b..d715c1563 100644 --- a/UI/window-basic-auto-config.hpp +++ b/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;