Skip to content

Commit

Permalink
frontend: Log streaming service recommended maximums
Browse files Browse the repository at this point in the history
Log the maximum recommended audio and video bitrate when the
user ticks the "Ignore streaming service setting recommendations" box.
  • Loading branch information
prgmitchell committed Jan 17, 2025
1 parent 79f5ba0 commit fa436f5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
14 changes: 13 additions & 1 deletion frontend/utility/AdvancedOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,19 @@ 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 MaxVBitrate, MaxABitrate;
obs_service_get_max_bitrate(main->GetService(), &MaxVBitrate, &MaxABitrate);

std::string videoBitrateStr = MaxVBitrate > 0 ? std::to_string(MaxVBitrate) : "None";
std::string audioBitrateStr = MaxABitrate > 0 ? std::to_string(MaxABitrate) : "None";

blog(LOG_INFO,
"User is ignoring service bitrate limits.\n"
"Service Recommendations:\n"
"\tvideo bitrate: %s\n"
"\taudio bitrate: %s",
videoBitrateStr.c_str(), audioBitrateStr.c_str());

obs_data_set_int(settings, "bitrate", bitrate);
}

Expand Down
14 changes: 13 additions & 1 deletion frontend/utility/SimpleOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,19 @@ void SimpleOutput::Update()
obs_service_apply_encoder_settings(main->GetService(), videoSettings, audioSettings);

if (!enforceBitrate) {
blog(LOG_INFO, "User is ignoring service bitrate limits.");
int maxVBitrate, maxABitrate;
obs_service_get_max_bitrate(main->GetService(), &maxVBitrate, &maxABitrate);

std::string videoBitrateStr = maxVBitrate > 0 ? std::to_string(maxVBitrate) : "None";
std::string audioBitrateStr = maxABitrate > 0 ? std::to_string(maxABitrate) : "None";

blog(LOG_INFO,
"User is ignoring service bitrate limits.\n"
"Service Recommendations:\n"
"\tvideo bitrate: %s\n"
"\taudio bitrate: %s",
videoBitrateStr.c_str(), audioBitrateStr.c_str());

obs_data_set_int(videoSettings, "bitrate", videoBitrate);
obs_data_set_int(audioSettings, "bitrate", audioBitrate);
}
Expand Down

0 comments on commit fa436f5

Please sign in to comment.