mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-03 16:25:54 +00:00
Add function for querying maximum supported streaming frame rate
This commit is contained in:
parent
d9ed3f9694
commit
59d087adf5
@ -67,6 +67,32 @@ bool StreamingPreferences::hasAnyHardwareAcceleration()
|
|||||||
1920, 1080, 60);
|
1920, 1080, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int StreamingPreferences::getMaximumStreamingFrameRate()
|
||||||
|
{
|
||||||
|
// Never let the maximum drop below 60 FPS
|
||||||
|
int maxFrameRate = 60;
|
||||||
|
|
||||||
|
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"SDL_InitSubSystem(SDL_INIT_VIDEO) failed: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
return maxFrameRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < SDL_GetNumVideoDisplays(); i++) {
|
||||||
|
SDL_DisplayMode mode;
|
||||||
|
if (SDL_GetCurrentDisplayMode(i, &mode) == 0) {
|
||||||
|
// Cap the frame rate at 90 FPS, since I can't seem to get
|
||||||
|
// much more out of GFE even with the game rendering at > 300 FPS.
|
||||||
|
maxFrameRate = qMax(maxFrameRate, qMin(90, mode.refresh_rate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
|
|
||||||
|
return maxFrameRate;
|
||||||
|
}
|
||||||
|
|
||||||
int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
int StreamingPreferences::getDefaultBitrate(int width, int height, int fps)
|
||||||
{
|
{
|
||||||
if (width * height * fps <= 1280 * 720 * 30) {
|
if (width * height * fps <= 1280 * 720 * 30) {
|
||||||
|
@ -16,6 +16,8 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE static bool hasAnyHardwareAcceleration();
|
Q_INVOKABLE static bool hasAnyHardwareAcceleration();
|
||||||
|
|
||||||
|
Q_INVOKABLE static int getMaximumStreamingFrameRate();
|
||||||
|
|
||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
enum AudioConfig
|
enum AudioConfig
|
||||||
|
Loading…
x
Reference in New Issue
Block a user