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:
parent
05b6346250
commit
d21891b3ca
1 changed files with 5 additions and 4 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue