mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 16:54:03 +02:00
WASAPI: Handle AUDCLNT_E_BUFFER_ERROR when processing audio data.
Public issue https://github.com/mackron/miniaudio/issues/410
This commit is contained in:
+2
-2
@@ -21964,7 +21964,7 @@ static ma_result ma_device_read__wasapi(ma_device* pDevice, void* pFrames, ma_ui
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
if (hr == MA_AUDCLNT_S_BUFFER_EMPTY) {
|
if (hr == MA_AUDCLNT_S_BUFFER_EMPTY || hr == MA_AUDCLNT_E_BUFFER_ERROR) {
|
||||||
/*
|
/*
|
||||||
No data is available. We need to wait for more. There's two situations to consider
|
No data is available. We need to wait for more. There's two situations to consider
|
||||||
here. The first is normal capture mode. If this times out it probably means the
|
here. The first is normal capture mode. If this times out it probably means the
|
||||||
@@ -22078,7 +22078,7 @@ static ma_result ma_device_write__wasapi(ma_device* pDevice, const void* pFrames
|
|||||||
pDevice->wasapi.mappedBufferPlaybackCap = bufferSizeInFrames;
|
pDevice->wasapi.mappedBufferPlaybackCap = bufferSizeInFrames;
|
||||||
pDevice->wasapi.mappedBufferPlaybackLen = 0;
|
pDevice->wasapi.mappedBufferPlaybackLen = 0;
|
||||||
} else {
|
} else {
|
||||||
if (hr == MA_AUDCLNT_E_BUFFER_TOO_LARGE) {
|
if (hr == MA_AUDCLNT_E_BUFFER_TOO_LARGE || hr == MA_AUDCLNT_E_BUFFER_ERROR) {
|
||||||
/* Not enough data available. We need to wait for more. */
|
/* Not enough data available. We need to wait for more. */
|
||||||
if (WaitForSingleObject(pDevice->wasapi.hEventPlayback, MA_WASAPI_WAIT_TIMEOUT_MILLISECONDS) != WAIT_OBJECT_0) {
|
if (WaitForSingleObject(pDevice->wasapi.hEventPlayback, MA_WASAPI_WAIT_TIMEOUT_MILLISECONDS) != WAIT_OBJECT_0) {
|
||||||
break; /* Wait failed. Probably timed out. */
|
break; /* Wait failed. Probably timed out. */
|
||||||
|
|||||||
Reference in New Issue
Block a user