mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 00:25:27 +00:00
wasapi: If GetDeviceBuf can't get a full buffer, go back to waiting.
Reference Issue #8924. (cherry picked from commit f931b25f4cd6180f98590b9697d3e6ad58b63bd0)
This commit is contained in:
parent
f1b109005c
commit
f6b9ebb838
|
@ -172,13 +172,18 @@ static SDL_bool RecoverWasapiIfLost(_THIS)
|
||||||
return lost ? RecoverWasapiDevice(this) : SDL_TRUE;
|
return lost ? RecoverWasapiDevice(this) : SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void WASAPI_WaitDevice(_THIS);
|
||||||
|
|
||||||
static Uint8 *WASAPI_GetDeviceBuf(_THIS)
|
static Uint8 *WASAPI_GetDeviceBuf(_THIS)
|
||||||
{
|
{
|
||||||
/* get an endpoint buffer from WASAPI. */
|
/* get an endpoint buffer from WASAPI. */
|
||||||
BYTE *buffer = NULL;
|
BYTE *buffer = NULL;
|
||||||
|
|
||||||
while (RecoverWasapiIfLost(this) && this->hidden->render) {
|
while (RecoverWasapiIfLost(this) && this->hidden->render) {
|
||||||
if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) {
|
const HRESULT ret = IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer);
|
||||||
|
if (ret == AUDCLNT_E_BUFFER_TOO_LARGE) {
|
||||||
|
WASAPI_WaitDevice(this); /* see if we can wait on the buffer to drain some more first... */
|
||||||
|
} else if (!WasapiFailed(this, ret)) {
|
||||||
return (Uint8 *)buffer;
|
return (Uint8 *)buffer;
|
||||||
}
|
}
|
||||||
SDL_assert(buffer == NULL);
|
SDL_assert(buffer == NULL);
|
||||||
|
|
Loading…
Reference in a new issue