From: dmitrykos Date: Tue, 22 Jun 2010 19:53:00 +0000 (+0000) Subject: wasapi: fixed very rare bug causing a dead looping if WASAPI input stream is being... X-Git-Tag: pa_stable_v19_20110326_r1647~116 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=fd47a098084e4b5087af68e98c81ebf1f20732a5;p=portaudio wasapi: fixed very rare bug causing a dead looping if WASAPI input stream is being aborted --- diff --git a/src/hostapi/wasapi/pa_win_wasapi.c b/src/hostapi/wasapi/pa_win_wasapi.c index 65e6ba7..990a142 100644 --- a/src/hostapi/wasapi/pa_win_wasapi.c +++ b/src/hostapi/wasapi/pa_win_wasapi.c @@ -3361,6 +3361,10 @@ static HRESULT ProcessInputBuffer(PaWasapiStream *stream, PaWasapiHostProcessor for (;;) { + // Check if blocking call must be interrupted + if (WaitForSingleObject(stream->hCloseRequest, 1) != WAIT_TIMEOUT) + break; + // Get the available data in the shared buffer. if ((hr = IAudioCaptureClient_GetBuffer(stream->cclient, &data, &frames, &flags, NULL, NULL)) != S_OK) {