Remove redundant initializtion of SDL video

This commit is contained in:
Cameron Gutman
2019-03-23 14:26:08 -07:00
parent d2cff86c97
commit c0bf8b9c25
2 changed files with 13 additions and 20 deletions

View File

@@ -289,12 +289,8 @@ int Session::getDecoderCapabilities(StreamingPreferences::VideoDecoderSelection
{
IVideoDecoder* decoder;
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"SDL_InitSubSystem(SDL_INIT_VIDEO) failed: %s",
SDL_GetError());
return false;
}
// Video must already be initialized to use this function
SDL_assert(SDL_WasInit(SDL_INIT_VIDEO));
SDL_Window* window = SDL_CreateWindow("", 0, 0, width, height, SDL_WINDOW_HIDDEN);
if (!window) {
@@ -319,8 +315,6 @@ int Session::getDecoderCapabilities(StreamingPreferences::VideoDecoderSelection
// the renderer may want to interact with the window
SDL_DestroyWindow(window);
SDL_QuitSubSystem(SDL_INIT_VIDEO);
return caps;
}
@@ -601,13 +595,6 @@ bool Session::validateLaunch()
return false;
}
// Add the capability flags from the chosen decoder/renderer
m_VideoCallbacks.capabilities |= getDecoderCapabilities(m_Preferences->videoDecoderSelection,
m_StreamConfig.supportsHevc ? VIDEO_FORMAT_H265 : VIDEO_FORMAT_H264,
m_StreamConfig.width,
m_StreamConfig.height,
m_StreamConfig.fps);
return true;
}
@@ -932,6 +919,14 @@ void Session::exec(int displayOriginX, int displayOriginY)
hostInfo.serverInfoGfeVersion = siGfeVersion.data();
}
// Add the capability flags from the chosen decoder/renderer
// Requires SDL_INIT_VIDEO already done.
m_VideoCallbacks.capabilities |= getDecoderCapabilities(m_Preferences->videoDecoderSelection,
m_StreamConfig.supportsHevc ? VIDEO_FORMAT_H265 : VIDEO_FORMAT_H264,
m_StreamConfig.width,
m_StreamConfig.height,
m_StreamConfig.fps);
int err = LiStartConnection(&hostInfo, &m_StreamConfig, &k_ConnCallbacks,
&m_VideoCallbacks,
m_AudioDisabled ? nullptr : &k_AudioCallbacks,