Commit 4c7021e5 authored by David Reid's avatar David Reid

WASAPI: Fix an error when stopping a device.

parent 856494d2
...@@ -23197,7 +23197,15 @@ static ma_result ma_device_stop__wasapi_nolock(ma_device* pDevice) ...@@ -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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment