winecoreaudio: Move creation of the audio unit to IAudioClient_Initialize().
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7d76fee5f4
commit
3810c693ca
|
@ -580,12 +580,6 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
|
||||||
|
|
||||||
This->adevid = adevid;
|
This->adevid = adevid;
|
||||||
|
|
||||||
if(!(This->stream->unit = get_audiounit(This->dataflow, This->adevid))){
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->stream);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
|
||||||
return AUDCLNT_E_DEVICE_INVALIDATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
*out = (IAudioClient *)&This->IAudioClient3_iface;
|
*out = (IAudioClient *)&This->IAudioClient3_iface;
|
||||||
IAudioClient3_AddRef(&This->IAudioClient3_iface);
|
IAudioClient3_AddRef(&This->IAudioClient3_iface);
|
||||||
|
|
||||||
|
@ -1262,6 +1256,14 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
|
||||||
if(mode == AUDCLNT_SHAREMODE_EXCLUSIVE)
|
if(mode == AUDCLNT_SHAREMODE_EXCLUSIVE)
|
||||||
This->stream->bufsize_frames -= This->stream->bufsize_frames % This->stream->period_frames;
|
This->stream->bufsize_frames -= This->stream->bufsize_frames % This->stream->period_frames;
|
||||||
|
|
||||||
|
if(!(This->stream->unit = get_audiounit(This->dataflow, This->adevid))){
|
||||||
|
CoTaskMemFree(This->stream->fmt);
|
||||||
|
This->stream->fmt = NULL;
|
||||||
|
OSSpinLockUnlock(&This->stream->lock);
|
||||||
|
LeaveCriticalSection(&g_sessions_lock);
|
||||||
|
return AUDCLNT_E_DEVICE_INVALIDATED;
|
||||||
|
}
|
||||||
|
|
||||||
hr = ca_setup_audiounit(This->dataflow, This->stream->unit, This->stream->fmt, &This->stream->dev_desc, &This->stream->converter);
|
hr = ca_setup_audiounit(This->dataflow, This->stream->unit, This->stream->fmt, &This->stream->dev_desc, &This->stream->converter);
|
||||||
if(FAILED(hr)){
|
if(FAILED(hr)){
|
||||||
CoTaskMemFree(This->stream->fmt);
|
CoTaskMemFree(This->stream->fmt);
|
||||||
|
|
Loading…
Reference in New Issue