From 041d3b4155d2942e499318c28a893fe8a567daaf Mon Sep 17 00:00:00 2001 From: Igor Bochkariov Date: Tue, 12 Mar 2019 18:58:26 +0400 Subject: [PATCH] win-wasapi: Fix audio capture after unplugging device This commit fixes a bug where the user would have to restart OBS when certain types of devices are unplugged and plugged back in again (particularly USB devices). A wait interval is required (RECONNECT_INTERVAL) because Windows does not send any events to IAudioCaptureClient on device invalidation. --- plugins/win-wasapi/win-wasapi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/win-wasapi/win-wasapi.cpp b/plugins/win-wasapi/win-wasapi.cpp index 60b8bc19..574f5280 100644 --- a/plugins/win-wasapi/win-wasapi.cpp +++ b/plugins/win-wasapi/win-wasapi.cpp @@ -448,7 +448,7 @@ DWORD WINAPI WASAPISource::CaptureThread(LPVOID param) bool reconnect = false; /* Output devices don't signal, so just make it check every 10 ms */ - DWORD dur = source->isInputDevice ? INFINITE : 10; + DWORD dur = source->isInputDevice ? RECONNECT_INTERVAL : 10; HANDLE sigs[2] = { source->receiveSignal, -- GitLab