Commit bb512a8f authored by David Reid's avatar David Reid

WASAPI: Fix a bug introduced in the previous commit.

This was resulting in a loop consuming 100% of the CPU.
parent ee2e7694
......@@ -15668,10 +15668,7 @@ static ma_result ma_device_audio_thread__wasapi(ma_device* pDevice)
break;
}
if (framesAvailablePlayback < pDevice->wasapi.periodSizeInFramesPlayback) {
continue; /* No space available. */
}
if (framesAvailablePlayback >= pDevice->wasapi.periodSizeInFramesPlayback) {
/* Map a the data buffer in preparation for the callback. */
hr = ma_IAudioRenderClient_GetBuffer((ma_IAudioRenderClient*)pDevice->wasapi.pRenderClient, framesAvailablePlayback, &pMappedDeviceBufferPlayback);
if (FAILED(hr)) {
......@@ -15695,6 +15692,7 @@ static ma_result ma_device_audio_thread__wasapi(ma_device* pDevice)
}
framesWrittenToPlaybackDevice += framesAvailablePlayback;
}
if (!c89atomic_load_8(&pDevice->wasapi.isStartedPlayback)) {
hr = ma_IAudioClient_Start((ma_IAudioClient*)pDevice->wasapi.pAudioClientPlayback);
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