win-wasapi: Register capture thread with MMCSS
Ensure audio gets more priority to help prevent glitching.master
parent
a995c305b7
commit
d1230c292e
|
@ -15,6 +15,7 @@ add_library(win-wasapi MODULE
|
||||||
${win-wasapi_SOURCES}
|
${win-wasapi_SOURCES}
|
||||||
${win-wasapi_HEADERS})
|
${win-wasapi_HEADERS})
|
||||||
target_link_libraries(win-wasapi
|
target_link_libraries(win-wasapi
|
||||||
|
Avrt
|
||||||
libobs)
|
libobs)
|
||||||
set_target_properties(win-wasapi PROPERTIES FOLDER "plugins")
|
set_target_properties(win-wasapi PROPERTIES FOLDER "plugins")
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
|
||||||
|
#include <avrt.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define OPT_DEVICE_ID "device_id"
|
#define OPT_DEVICE_ID "device_id"
|
||||||
|
@ -577,6 +579,9 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param)
|
||||||
hr);
|
hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD unused = 0;
|
||||||
|
const HANDLE handle = AvSetMmThreadCharacteristics(L"Audio", &unused);
|
||||||
|
|
||||||
WASAPISource *source = (WASAPISource *)param;
|
WASAPISource *source = (WASAPISource *)param;
|
||||||
|
|
||||||
const HANDLE inactive_sigs[] = {
|
const HANDLE inactive_sigs[] = {
|
||||||
|
@ -684,6 +689,9 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (handle)
|
||||||
|
AvRevertMmThreadCharacteristics(handle);
|
||||||
|
|
||||||
if (com_initialized)
|
if (com_initialized)
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue