[PATCH 1/2] wineandroid: Create OpenSL outputmix object globally
Andrew Eikum
aeikum at codeweavers.com
Mon Sep 25 13:14:12 CDT 2017
This object will take multiple inputs, no need to re-create it for
every IAudioClient.
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
dlls/wineandroid.drv/mmdevdrv.c | 40 +++++++++++++++++-----------------------
1 file changed, 17 insertions(+), 23 deletions(-)
diff --git a/dlls/wineandroid.drv/mmdevdrv.c b/dlls/wineandroid.drv/mmdevdrv.c
index 6b05c509f7..d661fb5a63 100644
--- a/dlls/wineandroid.drv/mmdevdrv.c
+++ b/dlls/wineandroid.drv/mmdevdrv.c
@@ -128,7 +128,6 @@ struct ACImpl {
HANDLE event;
float *vols;
- SLObjectItf outputmix;
SLObjectItf player;
SLObjectItf recorder;
SLAndroidSimpleBufferQueueItf bufq;
@@ -284,6 +283,7 @@ int WINAPI AUDDRV_GetPriority(void)
static SLObjectItf sl;
static SLEngineItf engine;
+static SLObjectItf outputmix;
HRESULT AUDDRV_Init(void)
{
@@ -310,6 +310,21 @@ HRESULT AUDDRV_Init(void)
return E_FAIL;
}
+ sr = SLCALL(engine, CreateOutputMix, &outputmix, 0, NULL, NULL);
+ if(sr != SL_RESULT_SUCCESS){
+ SLCALL_N(sl, Destroy);
+ WARN("CreateOutputMix failed: 0x%x\n", sr);
+ return E_FAIL;
+ }
+
+ sr = SLCALL(outputmix, Realize, SL_BOOLEAN_FALSE);
+ if(sr != SL_RESULT_SUCCESS){
+ SLCALL_N(outputmix, Destroy);
+ SLCALL_N(sl, Destroy);
+ WARN("outputmix Realize failed: 0x%x\n", sr);
+ return E_FAIL;
+ }
+
return S_OK;
}
@@ -347,7 +362,6 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev,
ACImpl *This;
HRESULT hr;
EDataFlow flow;
- SLresult sr;
TRACE("%s %p %p\n", debugstr_guid(guid), dev, out);
@@ -372,24 +386,6 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev,
return hr;
}
- if(flow == eRender){
- sr = SLCALL(engine, CreateOutputMix, &This->outputmix, 0, NULL, NULL);
- if(sr != SL_RESULT_SUCCESS){
- WARN("CreateOutputMix failed: 0x%x\n", sr);
- HeapFree(GetProcessHeap(), 0, This);
- return E_FAIL;
- }
-
- sr = SLCALL(This->outputmix, Realize, SL_BOOLEAN_FALSE);
- if(sr != SL_RESULT_SUCCESS){
- SLCALL_N(This->outputmix, Destroy);
- This->outputmix = NULL;
- HeapFree(GetProcessHeap(), 0, This);
- WARN("outputmix Realize failed: 0x%x\n", sr);
- return E_FAIL;
- }
- }
-
This->dataflow = flow;
This->IAudioClient_iface.lpVtbl = &AudioClient_Vtbl;
@@ -472,8 +468,6 @@ static ULONG WINAPI AudioClient_Release(IAudioClient *iface)
SLCALL_N(This->recorder, Destroy);
if(This->player)
SLCALL_N(This->player, Destroy);
- if(This->outputmix)
- SLCALL_N(This->outputmix, Destroy);
if(This->initted){
EnterCriticalSection(&g_sessions_lock);
@@ -776,7 +770,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient *iface,
source.pFormat = &pcm;
loc_outmix.locatorType = SL_DATALOCATOR_OUTPUTMIX;
- loc_outmix.outputMix = This->outputmix;
+ loc_outmix.outputMix = outputmix;
sink.pLocator = &loc_outmix;
sink.pFormat = NULL;
--
2.14.1
More information about the wine-patches
mailing list