diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 0db7bb75f1e..bbc26b1e684 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -101,6 +101,7 @@ struct ACImpl { LONG ref; IMMDevice *parent; + IUnknown *pUnkFTMarshal; WAVEFORMATEX *fmt; @@ -595,6 +596,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, { ACImpl *This; const OSSDevice *oss_dev; + HRESULT hr; TRACE("%s %p %p\n", debugstr_guid(guid), dev, out); @@ -608,6 +610,13 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, if(!This) return E_OUTOFMEMORY; + hr = CoCreateFreeThreadedMarshaler((IUnknown *)&This->IAudioClient_iface, + (IUnknown **)&This->pUnkFTMarshal); + if (FAILED(hr)) { + HeapFree(GetProcessHeap(), 0, This); + return hr; + } + if(oss_dev->flow == eRender) This->fd = open(oss_dev->devnode, O_WRONLY | O_NONBLOCK, 0); else if(oss_dev->flow == eCapture) @@ -672,6 +681,7 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, static HRESULT WINAPI AudioClient_QueryInterface(IAudioClient *iface, REFIID riid, void **ppv) { + ACImpl *This = impl_from_IAudioClient(iface); TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); if(!ppv) @@ -679,6 +689,8 @@ static HRESULT WINAPI AudioClient_QueryInterface(IAudioClient *iface, *ppv = NULL; if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IAudioClient)) *ppv = iface; + else if(IsEqualIID(riid, &IID_IMarshal)) + return IUnknown_QueryInterface(This->pUnkFTMarshal, riid, ppv); if(*ppv){ IUnknown_AddRef((IUnknown*)*ppv); return S_OK; @@ -705,6 +717,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient *iface) if(!ref){ IAudioClient_Stop(iface); IMMDevice_Release(This->parent); + IUnknown_Release(This->pUnkFTMarshal); This->lock.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->lock); close(This->fd); @@ -1750,6 +1763,7 @@ static const IAudioClientVtbl AudioClient_Vtbl = static HRESULT WINAPI AudioRenderClient_QueryInterface( IAudioRenderClient *iface, REFIID riid, void **ppv) { + ACImpl *This = impl_from_IAudioRenderClient(iface); TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); if(!ppv) @@ -1759,6 +1773,8 @@ static HRESULT WINAPI AudioRenderClient_QueryInterface( if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IAudioRenderClient)) *ppv = iface; + else if(IsEqualIID(riid, &IID_IMarshal)) + return IUnknown_QueryInterface(This->pUnkFTMarshal, riid, ppv); if(*ppv){ IUnknown_AddRef((IUnknown*)*ppv); return S_OK; @@ -1911,6 +1927,7 @@ static const IAudioRenderClientVtbl AudioRenderClient_Vtbl = { static HRESULT WINAPI AudioCaptureClient_QueryInterface( IAudioCaptureClient *iface, REFIID riid, void **ppv) { + ACImpl *This = impl_from_IAudioCaptureClient(iface); TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); if(!ppv) @@ -1920,6 +1937,8 @@ static HRESULT WINAPI AudioCaptureClient_QueryInterface( if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IAudioCaptureClient)) *ppv = iface; + else if(IsEqualIID(riid, &IID_IMarshal)) + return IUnknown_QueryInterface(This->pUnkFTMarshal, riid, ppv); if(*ppv){ IUnknown_AddRef((IUnknown*)*ppv); return S_OK;