From 49a1380bf18b7398c5cc1faffb79924343fb5b7d Mon Sep 17 00:00:00 2001 From: prgmitchell <86465454+prgmitchell@users.noreply.github.com> Date: Thu, 16 Jan 2025 18:49:20 -0500 Subject: [PATCH] frontend: Log streaming service recommended maximums Log the maximum recommended audio and video bitrate when the user ticks the "Ignore streaming service setting recommendations" box. --- frontend/utility/AdvancedOutput.cpp | 17 ++++++++++++++++- frontend/utility/SimpleOutput.cpp | 15 ++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/frontend/utility/AdvancedOutput.cpp b/frontend/utility/AdvancedOutput.cpp index 0d927721d1450c..5a15681073eb27 100644 --- a/frontend/utility/AdvancedOutput.cpp +++ b/frontend/utility/AdvancedOutput.cpp @@ -200,7 +200,22 @@ void AdvancedOutput::UpdateStreamSettings() int keyint_sec = (int)obs_data_get_int(settings, "keyint_sec"); obs_service_apply_encoder_settings(main->GetService(), settings, nullptr); if (!enforceBitrate) { - blog(LOG_INFO, "User is ignoring service bitrate limits."); + int maxVideoBitrate; + int maxAudioBitrate; + obs_service_get_max_bitrate(main->GetService(), &maxVideoBitrate, &maxAudioBitrate); + + std::string videoBitRateLogString = maxVideoBitrate > 0 ? std::to_string(maxVideoBitrate) + : "None"; + std::string audioBitRateLogString = maxAudioBitrate > 0 ? std::to_string(maxAudioBitrate) + : "None"; + + blog(LOG_INFO, + "User is ignoring service bitrate limits.\n" + "Service Recommendations:\n" + "\tvideo bitrate: %s\n" + "\taudio bitrate: %s", + videoBitRateLogString.c_str(), audioBitRateLogString.c_str()); + obs_data_set_int(settings, "bitrate", bitrate); } diff --git a/frontend/utility/SimpleOutput.cpp b/frontend/utility/SimpleOutput.cpp index 4e783dd7abd5a1..082e8f71d2f65b 100644 --- a/frontend/utility/SimpleOutput.cpp +++ b/frontend/utility/SimpleOutput.cpp @@ -318,7 +318,20 @@ void SimpleOutput::Update() obs_service_apply_encoder_settings(main->GetService(), videoSettings, audioSettings); if (!enforceBitrate) { - blog(LOG_INFO, "User is ignoring service bitrate limits."); + int maxVideoBitrate; + int maxAudioBitrate; + obs_service_get_max_bitrate(main->GetService(), &maxVideoBitrate, &maxAudioBitrate); + + std::string videoBitrateLogString = maxVideoBitrate > 0 ? std::to_string(maxVideoBitrate) : "None"; + std::string audioBitrateLogString = maxAudioBitrate > 0 ? std::to_string(maxAudioBitrate) : "None"; + + blog(LOG_INFO, + "User is ignoring service bitrate limits.\n" + "Service Recommendations:\n" + "\tvideo bitrate: %s\n" + "\taudio bitrate: %s", + videoBitrateLogString.c_str(), audioBitrateLogString.c_str()); + obs_data_set_int(videoSettings, "bitrate", videoBitrate); obs_data_set_int(audioSettings, "bitrate", audioBitrate); }