From 83f5f6cefcb8fd95491139c5f4d2fdd17c8b510f Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 2 Sep 2023 15:54:12 -0500 Subject: [PATCH] Don't scale default bitrate further beyond 90 FPS --- app/settings/streamingpreferences.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/settings/streamingpreferences.cpp b/app/settings/streamingpreferences.cpp index c9ba8d4b..bc455943 100644 --- a/app/settings/streamingpreferences.cpp +++ b/app/settings/streamingpreferences.cpp @@ -298,28 +298,31 @@ void StreamingPreferences::save() int StreamingPreferences::getDefaultBitrate(int width, int height, int fps) { + // Don't scale bitrate further beyond 90 FPS. It's definitely not a linear + // bitrate increase for frame rate once we get to values that high. + float frameRateFactor = qMin(90, fps) / 30; + // This table prefers 16:10 resolutions because they are // only slightly more pixels than the 16:9 equivalents, so // we don't want to bump those 16:10 resolutions up to the // next 16:9 slot. - if (width * height <= 640 * 360) { - return static_cast(1000 * (fps / 30.0)); + return static_cast(1000 * frameRateFactor); } else if (width * height <= 854 * 480) { - return static_cast(1500 * (fps / 30.0)); + return static_cast(1500 * frameRateFactor); } // This covers 1280x720 and 1280x800 too else if (width * height <= 1366 * 768) { - return static_cast(5000 * (fps / 30.0)); + return static_cast(5000 * frameRateFactor); } else if (width * height <= 1920 * 1200) { - return static_cast(10000 * (fps / 30.0)); + return static_cast(10000 * frameRateFactor); } else if (width * height <= 2560 * 1600) { - return static_cast(20000 * (fps / 30.0)); + return static_cast(20000 * frameRateFactor); } else /* if (width * height <= 3840 * 2160) */ { - return static_cast(40000 * (fps / 30.0)); + return static_cast(40000 * frameRateFactor); } }