mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-15 14:42:26 +00:00
Only initialize the video subsystem once per launch
This commit is contained in:
@@ -5,11 +5,6 @@
|
||||
|
||||
SystemProperties::SystemProperties()
|
||||
{
|
||||
hasHardwareAcceleration =
|
||||
Session::isHardwareDecodeAvailable(StreamingPreferences::VDS_AUTO,
|
||||
VIDEO_FORMAT_H264,
|
||||
1920, 1080, 60);
|
||||
|
||||
isRunningWayland = qgetenv("XDG_SESSION_TYPE") == "wayland";
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
@@ -51,17 +46,11 @@ void SystemProperties::querySdlVideoInfo()
|
||||
{
|
||||
monitorDesktopResolutions.clear();
|
||||
monitorNativeResolutions.clear();
|
||||
hasHardwareAcceleration = false;
|
||||
|
||||
// Never let the maximum drop below 60 FPS
|
||||
maximumStreamingFrameRate = 60;
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_InitSubSystem(SDL_INIT_VIDEO) failed: %s",
|
||||
SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_DisplayMode bestMode;
|
||||
for (int displayIndex = 0; displayIndex < SDL_GetNumVideoDisplays(); displayIndex++) {
|
||||
SDL_DisplayMode desktopMode;
|
||||
@@ -97,5 +86,19 @@ void SystemProperties::querySdlVideoInfo()
|
||||
}
|
||||
}
|
||||
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
SDL_Window* testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN);
|
||||
if (!testWindow) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to create window for hardware decode test: %s",
|
||||
SDL_GetError());
|
||||
return;
|
||||
}
|
||||
|
||||
hasHardwareAcceleration =
|
||||
Session::isHardwareDecodeAvailable(testWindow,
|
||||
StreamingPreferences::VDS_AUTO,
|
||||
VIDEO_FORMAT_H264,
|
||||
1920, 1080, 60);
|
||||
|
||||
SDL_DestroyWindow(testWindow);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user