win-wasapi: Register capture thread with MMCSS
Ensure audio gets more priority to help prevent glitching.
This commit is contained in:
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user