mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-14 05:12:27 +00:00
Fix handling of undefined and non-matching refresh rate
This commit is contained in:
parent
587d783955
commit
4dba74e2f9
2 changed files with 19 additions and 2 deletions
|
@ -637,6 +637,16 @@ void Session::updateOptimalWindowDisplayMode()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bestMode.refresh_rate == 0) {
|
||||||
|
// We may find no match if the user has moved a 120 FPS
|
||||||
|
// stream onto a 60 Hz monitor (since no refresh rate can
|
||||||
|
// divide our FPS setting). We'll stick to the default in
|
||||||
|
// this case.
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"No matching refresh rate found; using desktop mode");
|
||||||
|
bestMode = desktopMode;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Chosen best display mode: %dx%dx%d",
|
"Chosen best display mode: %dx%dx%d",
|
||||||
bestMode.w, bestMode.h, bestMode.refresh_rate);
|
bestMode.w, bestMode.h, bestMode.refresh_rate);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "pacer.h"
|
#include "pacer.h"
|
||||||
#include "streaming/streamutils.h"
|
|
||||||
|
|
||||||
#include "nullthreadedvsyncsource.h"
|
#include "nullthreadedvsyncsource.h"
|
||||||
|
|
||||||
|
@ -144,13 +143,21 @@ bool Pacer::initialize(SDL_Window* window, int maxVideoFps, bool enableVsync)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Use the current display mode for windowed and borderless
|
// Use the current display mode for windowed and borderless
|
||||||
if (!StreamUtils::getRealDesktopMode(displayIndex, &mode)) {
|
if (SDL_GetCurrentDisplayMode(displayIndex, &mode) != 0) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"SDL_GetCurrentDisplayMode() failed: %s",
|
||||||
|
SDL_GetError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// May be zero if undefined
|
// May be zero if undefined
|
||||||
m_DisplayFps = mode.refresh_rate;
|
m_DisplayFps = mode.refresh_rate;
|
||||||
|
if (m_DisplayFps == 0) {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Refresh rate unknown; assuming 60 Hz");
|
||||||
|
m_DisplayFps = 60;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_EnableVsync) {
|
if (m_EnableVsync) {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
|
Loading…
Reference in a new issue