/* Getting here means we failed the reroute attempt. Sleep for a bit and retry. */
ma_sleep(retryDelayInMilliseconds);
}
ma_mutex_unlock(&pDevice->wasapi.rerouteLock);
if (result != MA_SUCCESS) {
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to reroute playback device after AUDCLNT_E_DEVICE_INVALIDATED. Aborting.");
if (iRetry == retryCount) {
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to reroute device after AUDCLNT_E_DEVICE_INVALIDATED. Aborting.");
result = MA_ERROR;
break;
}
/* The device will need to be started again or else we'll get stuck. */
ma_device_start__wasapi(pDevice);
} else {
/* The device has been invalidated, but we're using a specific device. We'll just need to abort. */
ma_log_postf(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] The playback device has been invalidated (AUDCLNT_E_DEVICE_INVALIDATED). Aborting.");