wasapi: ensure that wasapi context structure is zeroed before filling it

I had a situation where I was doing:

    ma_backend backends[] = {
	ma_backend_jack,
	ma_backend_wasapi,
    };
    ma_context_init(backends, sizeof(backends)/sizeof(backends[0]),
	&contextConfig, &context);

And since JACK was unavailable, it fell back to WASAPI. When this
happened, the WASAPI commandIndex and commandCount variables were
already stomped on by the JACK backend initialization, but the WASAPI
backend assumes they are zero-initialized.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
This commit is contained in:
Steven Noonan
2021-03-10 07:43:54 -08:00
parent 0a7207d5db
commit e4ff49d558
+2
View File
@@ -16257,6 +16257,8 @@ static ma_result ma_context_init__wasapi(ma_context* pContext, const ma_context_
return result; return result;
} }
MA_ZERO_OBJECT(&pContext->wasapi);
/* /*
Annoyingly, WASAPI does not allow you to release an IAudioClient object from a different thread Annoyingly, WASAPI does not allow you to release an IAudioClient object from a different thread
than the one that retrieved it with GetService(). This can result in a deadlock in two than the one that retrieved it with GetService(). This can result in a deadlock in two