mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-10 02:08:43 +00:00
Round default bitrates to the nearest megabit
This commit is contained in:
parent
2f9c44103b
commit
b968886594
1 changed files with 8 additions and 8 deletions
|
@ -309,17 +309,17 @@ int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
||||||
int pixels;
|
int pixels;
|
||||||
int factor;
|
int factor;
|
||||||
} resTable[] {
|
} resTable[] {
|
||||||
{ 640 * 360, 10 },
|
{ 640 * 360, 1 },
|
||||||
{ 854 * 480, 20 },
|
{ 854 * 480, 2 },
|
||||||
{ 1280 * 720, 50 },
|
{ 1280 * 720, 5 },
|
||||||
{ 1920 * 1080, 100 },
|
{ 1920 * 1080, 10 },
|
||||||
{ 2560 * 1440, 200 },
|
{ 2560 * 1440, 20 },
|
||||||
{ 3840 * 2160, 400 },
|
{ 3840 * 2160, 40 },
|
||||||
{ -1, -1 },
|
{ -1, -1 },
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calculate the resolution factor by linear interpolation of the resolution table
|
// Calculate the resolution factor by linear interpolation of the resolution table
|
||||||
int resolutionFactor;
|
float resolutionFactor;
|
||||||
int pixels = width * height;
|
int pixels = width * height;
|
||||||
for (int i = 0;; i++) {
|
for (int i = 0;; i++) {
|
||||||
if (pixels == resTable[i].pixels) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue