0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

win-wasapi: Fix Stop hang

Fix hang when audio capture is active in the background and stopped by
either closing OBS, or switching scene collections.
This commit is contained in:
jpark37 2022-10-01 09:41:53 -07:00 committed by jp9000
parent 05b6346250
commit d21891b3ca

View File

@ -528,9 +528,6 @@ void WASAPISource::Start()
void WASAPISource::Stop()
{
if (!reconnectThread.Valid())
WaitForSingleObject(reconnectSignal, INFINITE);
SetEvent(stopSignal);
blog(LOG_INFO, "WASAPI: Device '%s' Terminated", device_name.c_str());
@ -538,8 +535,12 @@ void WASAPISource::Stop()
if (rtwq_supported)
SetEvent(receiveSignal);
if (reconnectThread.Valid())
if (reconnectThread.Valid()) {
WaitForSingleObject(idleSignal, INFINITE);
} else {
const HANDLE sigs[] = {reconnectSignal, idleSignal};
WaitForMultipleObjects(_countof(sigs), sigs, false, INFINITE);
}
SetEvent(exitSignal);