mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 22:01:46 +00:00
[host] windows: fix usage of MCSS and try to get priority "Capture"
This commit is contained in:
parent
2f8b139131
commit
34e5f7e968
2 changed files with 15 additions and 1 deletions
|
@ -27,6 +27,7 @@ target_link_libraries(platform_Windows
|
||||||
shlwapi
|
shlwapi
|
||||||
powrprof
|
powrprof
|
||||||
rpcrt4
|
rpcrt4
|
||||||
|
avrt
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(platform_Windows
|
target_include_directories(platform_Windows
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <userenv.h>
|
#include <userenv.h>
|
||||||
#include <winternl.h>
|
#include <winternl.h>
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
|
#include <avrt.h>
|
||||||
|
|
||||||
#include "interface/platform.h"
|
#include "interface/platform.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
@ -60,6 +61,7 @@ struct AppState
|
||||||
UINT trayRestartMsg;
|
UINT trayRestartMsg;
|
||||||
HMENU trayMenu;
|
HMENU trayMenu;
|
||||||
HANDLE exitWait;
|
HANDLE exitWait;
|
||||||
|
HANDLE taskHandle;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct AppState app = {0};
|
static struct AppState app = {0};
|
||||||
|
@ -450,6 +452,9 @@ finish:
|
||||||
free(app.argv[i]);
|
free(app.argv[i]);
|
||||||
free(app.argv);
|
free(app.argv);
|
||||||
|
|
||||||
|
if (app.taskHandle)
|
||||||
|
AvRevertMmThreadCharacteristics(app.taskHandle);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,7 +484,15 @@ void boostPriority(void)
|
||||||
DEBUG_INFO("looking-glass-host.exe InstallService");
|
DEBUG_INFO("looking-glass-host.exe InstallService");
|
||||||
}
|
}
|
||||||
|
|
||||||
DwmEnableMMCSS(true);
|
DWORD taskIndex = 0;
|
||||||
|
app.taskHandle =
|
||||||
|
AvSetMmThreadCharacteristicsA("Capture", &taskIndex);
|
||||||
|
|
||||||
|
if (!app.taskHandle)
|
||||||
|
DEBUG_WINERROR("AvSetMmThreadCharacteristicsA failed", GetLastError());
|
||||||
|
|
||||||
|
if (!AvSetMmThreadPriority(app.taskHandle, AVRT_PRIORITY_CRITICAL))
|
||||||
|
DEBUG_WINERROR("Failed to set thread priority", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK exitEventCallback(PVOID opaque, BOOLEAN timedOut)
|
void CALLBACK exitEventCallback(PVOID opaque, BOOLEAN timedOut)
|
||||||
|
|
Loading…
Reference in a new issue