From b96888659498ce10ba76eaf81e82a43b4f266c48 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 11 Sep 2023 01:18:52 -0500 Subject: [PATCH] Round default bitrates to the nearest megabit --- app/settings/streamingpreferences.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/settings/streamingpreferences.cpp b/app/settings/streamingpreferences.cpp index 275616a2..6a883bc0 100644 --- a/app/settings/streamingpreferences.cpp +++ b/app/settings/streamingpreferences.cpp @@ -309,17 +309,17 @@ int StreamingPreferences::getDefaultBitrate(int width, int height, int fps) int pixels; int factor; } resTable[] { - { 640 * 360, 10 }, - { 854 * 480, 20 }, - { 1280 * 720, 50 }, - { 1920 * 1080, 100 }, - { 2560 * 1440, 200 }, - { 3840 * 2160, 400 }, + { 640 * 360, 1 }, + { 854 * 480, 2 }, + { 1280 * 720, 5 }, + { 1920 * 1080, 10 }, + { 2560 * 1440, 20 }, + { 3840 * 2160, 40 }, { -1, -1 }, }; // Calculate the resolution factor by linear interpolation of the resolution table - int resolutionFactor; + float resolutionFactor; int pixels = width * height; for (int i = 0;; i++) { if (pixels == resTable[i].pixels) { @@ -345,5 +345,5 @@ int StreamingPreferences::getDefaultBitrate(int width, int height, int fps) } } - return (int)(resolutionFactor * frameRateFactor) * 100; + return qRound(resolutionFactor * frameRateFactor) * 1000; }