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_HEADERS})
|
||||
target_link_libraries(win-wasapi
|
||||
Avrt
|
||||
libobs)
|
||||
set_target_properties(win-wasapi PROPERTIES FOLDER "plugins")
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include <atomic>
|
||||
#include <cinttypes>
|
||||
|
||||
#include <avrt.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define OPT_DEVICE_ID "device_id"
|
||||
|
@ -577,6 +579,9 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param)
|
|||
hr);
|
||||
}
|
||||
|
||||
DWORD unused = 0;
|
||||
const HANDLE handle = AvSetMmThreadCharacteristics(L"Audio", &unused);
|
||||
|
||||
WASAPISource *source = (WASAPISource *)param;
|
||||
|
||||
const HANDLE inactive_sigs[] = {
|
||||
|
@ -684,6 +689,9 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param)
|
|||
}
|
||||
}
|
||||
|
||||
if (handle)
|
||||
AvRevertMmThreadCharacteristics(handle);
|
||||
|
||||
if (com_initialized)
|
||||
CoUninitialize();
|
||||
|
||||
|
|
Loading…
Reference in New Issue