[PATCH 06/12] winecoreaudio: Move start to the unixlib.
Huw Davies
huw at codeweavers.com
Tue Nov 23 01:55:03 CST 2021
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/winecoreaudio.drv/coreaudio.c | 20 +++++++++++++++
dlls/winecoreaudio.drv/mmdevdrv.c | 39 ++++++++++++------------------
dlls/winecoreaudio.drv/unixlib.h | 7 ++++++
3 files changed, 43 insertions(+), 23 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c
index 76febf1eb91..133ab3da124 100644
--- a/dlls/winecoreaudio.drv/coreaudio.c
+++ b/dlls/winecoreaudio.drv/coreaudio.c
@@ -1237,11 +1237,31 @@ static NTSTATUS get_current_padding(void *args)
return STATUS_SUCCESS;
}
+static NTSTATUS start(void *args)
+{
+ struct start_params *params = args;
+ struct coreaudio_stream *stream = params->stream;
+
+ OSSpinLockLock(&stream->lock);
+
+ if(stream->playing)
+ params->result = AUDCLNT_E_NOT_STOPPED;
+ else{
+ stream->playing = TRUE;
+ params->result = S_OK;
+ }
+
+ OSSpinLockUnlock(&stream->lock);
+
+ return STATUS_SUCCESS;
+}
+
unixlib_entry_t __wine_unix_call_funcs[] =
{
get_endpoint_ids,
create_stream,
release_stream,
+ start,
get_mix_format,
is_format_supported,
get_buffer_size,
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c
index 5d140665a83..30858931338 100644
--- a/dlls/winecoreaudio.drv/mmdevdrv.c
+++ b/dlls/winecoreaudio.drv/mmdevdrv.c
@@ -996,38 +996,31 @@ void CALLBACK ca_period_cb(void *user, BOOLEAN timer)
static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
{
ACImpl *This = impl_from_IAudioClient3(iface);
+ struct start_params params;
TRACE("(%p)\n", This);
if(!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
- OSSpinLockLock(&This->stream->lock);
-
- if(This->stream->playing){
- OSSpinLockUnlock(&This->stream->lock);
- return AUDCLNT_E_NOT_STOPPED;
- }
-
- if((This->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !This->event){
- OSSpinLockUnlock(&This->stream->lock);
+ if((This->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !This->event)
return AUDCLNT_E_EVENTHANDLE_NOT_SET;
- }
-
- if(This->event && !This->timer)
- if(!CreateTimerQueueTimer(&This->timer, g_timer_q, ca_period_cb,
- This, 0, This->period_ms, WT_EXECUTEINTIMERTHREAD)){
- This->timer = NULL;
- OSSpinLockUnlock(&This->stream->lock);
- WARN("Unable to create timer: %u\n", GetLastError());
- return E_OUTOFMEMORY;
- }
-
- This->stream->playing = TRUE;
- OSSpinLockUnlock(&This->stream->lock);
+ params.stream = This->stream;
+ UNIX_CALL(start, ¶ms);
- return S_OK;
+ if(SUCCEEDED(params.result)){
+ if(This->event && !This->timer){
+ if(!CreateTimerQueueTimer(&This->timer, g_timer_q, ca_period_cb, This, 0,
+ This->period_ms, WT_EXECUTEINTIMERTHREAD)){
+ This->timer = NULL;
+ IAudioClient3_Stop(iface);
+ WARN("Unable to create timer: %u\n", GetLastError());
+ return E_OUTOFMEMORY;
+ }
+ }
+ }
+ return params.result;
}
static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h
index 072ffd233c3..b4e9e5bf950 100644
--- a/dlls/winecoreaudio.drv/unixlib.h
+++ b/dlls/winecoreaudio.drv/unixlib.h
@@ -75,6 +75,12 @@ struct release_stream_params
HRESULT result;
};
+struct start_params
+{
+ struct coreaudio_stream *stream;
+ HRESULT result;
+};
+
struct get_mix_format_params
{
EDataFlow flow;
@@ -120,6 +126,7 @@ enum unix_funcs
unix_get_endpoint_ids,
unix_create_stream,
unix_release_stream,
+ unix_start,
unix_get_mix_format,
unix_is_format_supported,
unix_get_buffer_size,
--
2.23.0
More information about the wine-devel
mailing list