(XAudio+DSound) Fail instead of crash (#12527)

This commit is contained in:
Tony 2021-06-16 16:35:20 +03:00 committed by GitHub
parent 946d87cf89
commit 49bd8d2d27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -546,7 +546,8 @@ static ssize_t dsound_write(void *data, const void *buf_, size_t size)
break;
if (avail == 0)
WaitForSingleObject(ds->event, INFINITE);
if (!(WaitForSingleObject(ds->event, 50) == WAIT_OBJECT_0))
return -1;
}
}

View File

@ -371,7 +371,8 @@ static ssize_t xa_write(void *data, const void *buf, size_t size)
XAUDIO2_BUFFER xa2buffer;
while (handle->buffers == MAX_BUFFERS - 1)
WaitForSingleObject(handle->hEvent, INFINITE);
if (!(WaitForSingleObject(handle->hEvent, 50) == WAIT_OBJECT_0))
return -1;
xa2buffer.Flags = 0;
xa2buffer.AudioBytes = handle->bufsize;