From d3f7204cff64020f9067278da56b1a54ec8a85f4 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 16 Jul 2018 21:25:59 -0700 Subject: [PATCH] Set the main thread to high priority since it's used for rendering --- app/streaming/session.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index a581fab0..cd7208bf 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -386,6 +386,14 @@ void Session::exec() // Disable the screen saver SDL_DisableScreenSaver(); + // Raise the priority of the main thread, since it handles + // time-sensitive video rendering + if (SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH) < 0) { + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "Unable to set main thread to high priority: %s", + SDL_GetError()); + } + // Hijack this thread to be the SDL main thread. We have to do this // because we want to suspend all Qt processing until the stream is over. SDL_Event event;