From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 64b399f2a2b..1a358af660f 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -952,24 +952,32 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) { ACImpl *This = impl_from_IAudioClient3(iface); struct start_params params; - HRESULT hr;
TRACE("(%p)\n", This);
- if (!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; + sessions_lock(); + + if (!This->stream) { + params.result = AUDCLNT_E_NOT_INITIALIZED; + goto exit; + }
params.stream = This->stream; - pulse_call(start, ¶ms); - if (FAILED(hr = params.result)) - return hr;
- if (!This->timer_thread) { - This->timer_thread = CreateThread(NULL, 0, pulse_timer_cb, This, 0, NULL); + WINE_UNIX_CALL(start, ¶ms); + + if (SUCCEEDED(params.result) && !This->timer_thread) { + if (!(This->timer_thread = CreateThread(NULL, 0, pulse_timer_cb, This, 0, NULL))) { + params.result = E_FAIL; + goto exit; + } + SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL); } +exit: + sessions_unlock();
- return S_OK; + return params.result; }
extern HRESULT WINAPI client_Stop(IAudioClient3 *iface);