Skip to content

Commit

Permalink
UI: Forward auto rtmp/rtmps IVS preference
Browse files Browse the repository at this point in the history
(cherry picked from commit ffa7516)
  • Loading branch information
palana authored and RytoEX committed Nov 18, 2024
1 parent a00595c commit 4c1f783
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
21 changes: 14 additions & 7 deletions UI/multitrack-video-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ bool MultitrackVideoDeveloperModeEnabled()
}

static OBSServiceAutoRelease create_service(const GoLiveApi::Config &go_live_config,
const std::optional<std::string> &rtmp_url, const QString &in_stream_key)
const std::optional<std::string> &rtmp_url, const QString &in_stream_key,
std::optional<bool> use_rtmps)
{
const char *url = nullptr;
QString stream_key = in_stream_key;
Expand All @@ -69,6 +70,9 @@ static OBSServiceAutoRelease create_service(const GoLiveApi::Config &go_live_con
if (qstrnicmp("RTMP", endpoint.protocol.c_str(), 4))
continue;

if (use_rtmps.has_value() && *use_rtmps != (qstricmp("RTMPS", endpoint.protocol.c_str()) == 0))
continue;

url = endpoint.url_template.c_str();
if (endpoint.authentication && !endpoint.authentication->empty()) {
blog(LOG_INFO, "Using stream key supplied by autoconfig");
Expand Down Expand Up @@ -292,11 +296,14 @@ static OBSOutputs SetupOBSOutput(QWidget *parent, const QString &multitrack_vide
static void SetupSignalHandlers(bool recording, MultitrackVideoOutput *self, obs_output_t *output, OBSSignal &start,
OBSSignal &stop, OBSSignal &deactivate);

void MultitrackVideoOutput::PrepareStreaming(
QWidget *parent, const char *service_name, obs_service_t *service, const std::optional<std::string> &rtmp_url,
const QString &stream_key, const char *audio_encoder_id, std::optional<uint32_t> maximum_aggregate_bitrate,
std::optional<uint32_t> maximum_video_tracks, std::optional<std::string> custom_config,
obs_data_t *dump_stream_to_file_config, size_t main_audio_mixer, std::optional<size_t> vod_track_mixer)
void MultitrackVideoOutput::PrepareStreaming(QWidget *parent, const char *service_name, obs_service_t *service,
const std::optional<std::string> &rtmp_url, const QString &stream_key,
const char *audio_encoder_id,
std::optional<uint32_t> maximum_aggregate_bitrate,
std::optional<uint32_t> maximum_video_tracks,
std::optional<std::string> custom_config,
obs_data_t *dump_stream_to_file_config, size_t main_audio_mixer,
std::optional<size_t> vod_track_mixer, std::optional<bool> use_rtmps)
{
{
const std::lock_guard<std::mutex> current_lock{current_mutex};
Expand Down Expand Up @@ -396,7 +403,7 @@ void MultitrackVideoOutput::PrepareStreaming(
throw MultitrackVideoError::warning(
QTStr("FailedToStartStream.FallbackToDefault").arg(multitrack_video_name));

auto multitrack_video_service = create_service(service_config, rtmp_url, stream_key);
auto multitrack_video_service = create_service(service_config, rtmp_url, stream_key, use_rtmps);
if (!multitrack_video_service)
throw MultitrackVideoError::warning(
QTStr("FailedToStartStream.FallbackToDefault").arg(multitrack_video_name));
Expand Down
2 changes: 1 addition & 1 deletion UI/multitrack-video-output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct MultitrackVideoOutput {
const char *audio_encoder_id, std::optional<uint32_t> maximum_aggregate_bitrate,
std::optional<uint32_t> maximum_video_tracks, std::optional<std::string> custom_config,
obs_data_t *dump_stream_to_file_config, size_t main_audio_mixer,
std::optional<size_t> vod_track_mixer);
std::optional<size_t> vod_track_mixer, std::optional<bool> use_rtmps);
signal_handler_t *StreamingSignalHandler();
void StartedStreaming();
void StopStreaming();
Expand Down
6 changes: 5 additions & 1 deletion UI/window-basic-main-outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2425,9 +2425,13 @@ std::shared_future<void> BasicOutputHandler::SetupMultitrackVideo(obs_service_t
}

std::optional<std::string> custom_rtmp_url;
std::optional<bool> use_rtmps;
auto server = obs_data_get_string(settings, "server");
if (strncmp(server, "auto", 4) != 0) {
custom_rtmp_url = server;
} else {
QString server_ = server;
use_rtmps = server_.contains("rtmps", Qt::CaseInsensitive);
}

auto service_custom_server = obs_data_get_bool(settings, "using_custom_server");
Expand Down Expand Up @@ -2485,7 +2489,7 @@ std::shared_future<void> BasicOutputHandler::SetupMultitrackVideo(obs_service_t
multitrackVideo->PrepareStreaming(main, service_name.c_str(), service, custom_rtmp_url, key,
audio_encoder_id.c_str(), maximum_aggregate_bitrate,
maximum_video_tracks, custom_config, stream_dump_config,
main_audio_mixer, vod_track_mixer);
main_audio_mixer, vod_track_mixer, use_rtmps);
} catch (const MultitrackVideoError &error_) {
error.emplace(error_);
}
Expand Down

0 comments on commit 4c1f783

Please sign in to comment.