Avoid setting timer resolution to 1 ms while Moonlight is not streaming
This commit is contained in:
parent
611d9ac1ba
commit
cf2d8f71d6
2 changed files with 10 additions and 0 deletions
|
|
@ -200,6 +200,11 @@ int main(int argc, char *argv[])
|
|||
SDL_GetError());
|
||||
}
|
||||
|
||||
// Avoid the default behavior of changing the timer resolution to 1 ms.
|
||||
// We don't want this all the time that Moonlight is open. We will set
|
||||
// it manually when we start streaming.
|
||||
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "0");
|
||||
|
||||
int err = app.exec();
|
||||
|
||||
SDL_Quit();
|
||||
|
|
|
|||
|
|
@ -756,6 +756,10 @@ void Session::exec()
|
|||
// Disable the screen saver
|
||||
SDL_DisableScreenSaver();
|
||||
|
||||
// Set timer resolution to 1 ms on Windows for greater
|
||||
// sleep precision and more accurate callback timing.
|
||||
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "1");
|
||||
|
||||
// Raise the priority of the main thread, since it handles
|
||||
// time-sensitive video rendering
|
||||
if (SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH) < 0) {
|
||||
|
|
@ -873,6 +877,7 @@ DispatchDeferredCleanup:
|
|||
// so we can return to the Qt GUI ASAP.
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
SDL_EnableScreenSaver();
|
||||
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "0");
|
||||
|
||||
// Destroy the decoder, since this must be done on the main thread
|
||||
SDL_AtomicLock(&m_DecoderLock);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue