mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
WASAPI: Fix an error when stopping a device.
This commit is contained in:
+9
-1
@@ -23197,7 +23197,15 @@ static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* The audio client needs to be reset otherwise restarting will fail. */
|
/* The audio client needs to be reset otherwise restarting will fail. */
|
||||||
hr = ma_IAudioClient_Reset((ma_IAudioClient*)pDevice->wasapi.pAudioClientPlayback);
|
{
|
||||||
|
ma_int32 retries = 5;
|
||||||
|
|
||||||
|
while ((hr = ma_IAudioClient_Reset((ma_IAudioClient*)pDevice->wasapi.pAudioClientPlayback)) == MA_AUDCLNT_E_BUFFER_OPERATION_PENDING && retries > 0) {
|
||||||
|
ma_sleep(10);
|
||||||
|
retries -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to reset internal playback device.");
|
ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to reset internal playback device.");
|
||||||
return ma_result_from_HRESULT(hr);
|
return ma_result_from_HRESULT(hr);
|
||||||
|
|||||||
Reference in New Issue
Block a user