Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frontend: Log streaming service recommended maximums #11733

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion frontend/utility/AdvancedOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Comment on lines +207 to +217
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder a bit if we're not overcomplicating this. We could instead:

			blog(LOG_INFO,
			     "User is ignoring service bitrate limits.\n"
			     "Service Recommendations:\n"
			     "\tvideo bitrate: %d\n"
			     "\taudio bitrate: %d",
			     maxVideoBitrate, maxAudioBitrate);

Or are maxVideoBitrate and maxAudioBitrate not guaranteed to be zero if no value is specified? Is there value in distinguishing 0 from None?

Copy link
Member Author

@prgmitchell prgmitchell Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had originally done it this way actually but to me it seemed to read a little more awkward/unclear if we were to log a max value as 0 when it is actually meant that there is no max recommended value at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm willing to wait a bit for a other opinions. It just jumped out to me at first glance that it seemed like extra work here, and I wasn't sure how much extra clarity it granted. cc @Warchamp7


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

Expand Down
15 changes: 14 additions & 1 deletion frontend/utility/SimpleOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Loading