Huw Davies : wineoss: Move start to the unixlib.
Alexandre Julliard
julliard at winehq.org
Thu Apr 14 16:50:33 CDT 2022
Module: wine
Branch: master
Commit: cc8e8bc6920aa8999c55ffe1a744ad9c3983e934
URL: https://source.winehq.org/git/wine.git/?a=commit;h=cc8e8bc6920aa8999c55ffe1a744ad9c3983e934
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Apr 13 07:38:49 2022 +0100
wineoss: Move start to the unixlib.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wineoss.drv/mmdevdrv.c | 24 +++++-------------------
dlls/wineoss.drv/oss.c | 19 +++++++++++++++++++
dlls/wineoss.drv/unixlib.h | 7 +++++++
3 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c
index 8f2b19c8faa..e50a7b32338 100644
--- a/dlls/wineoss.drv/mmdevdrv.c
+++ b/dlls/wineoss.drv/mmdevdrv.c
@@ -934,7 +934,7 @@ static void silence_buffer(struct oss_stream *stream, BYTE *buffer, UINT32 frame
static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
{
ACImpl *This = impl_from_IAudioClient3(iface);
- struct oss_stream *stream = This->stream;
+ struct start_params params;
TRACE("(%p)\n", This);
@@ -945,31 +945,17 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
return AUDCLNT_E_NOT_INITIALIZED;
}
- oss_lock(stream);
-
- if((stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !stream->event){
- oss_unlock(stream);
- LeaveCriticalSection(&g_sessions_lock);
- return AUDCLNT_E_EVENTHANDLE_NOT_SET;
- }
-
- if(stream->playing){
- oss_unlock(stream);
- LeaveCriticalSection(&g_sessions_lock);
- return AUDCLNT_E_NOT_STOPPED;
- }
+ params.stream = This->stream;
+ OSS_CALL(start, ¶ms);
- if(!This->timer_thread){
+ if(SUCCEEDED(params.result) && !This->timer_thread){
This->timer_thread = CreateThread(NULL, 0, timer_thread, This->stream, 0, NULL);
SetThreadPriority(This->timer_thread, THREAD_PRIORITY_TIME_CRITICAL);
}
- stream->playing = TRUE;
-
- oss_unlock(stream);
LeaveCriticalSection(&g_sessions_lock);
- return S_OK;
+ return params.result;
}
static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c
index b0dc22a500f..241b6d014ec 100644
--- a/dlls/wineoss.drv/oss.c
+++ b/dlls/wineoss.drv/oss.c
@@ -627,6 +627,24 @@ static NTSTATUS release_stream(void *args)
return STATUS_SUCCESS;
}
+static NTSTATUS start(void *args)
+{
+ struct start_params *params = args;
+ struct oss_stream *stream = params->stream;
+
+ oss_lock(stream);
+
+ if((stream->flags & AUDCLNT_STREAMFLAGS_EVENTCALLBACK) && !stream->event)
+ return oss_unlock_result(stream, ¶ms->result, AUDCLNT_E_EVENTHANDLE_NOT_SET);
+
+ if(stream->playing)
+ return oss_unlock_result(stream, ¶ms->result, AUDCLNT_E_NOT_STOPPED);
+
+ stream->playing = TRUE;
+
+ return oss_unlock_result(stream, ¶ms->result, S_OK);
+}
+
static void silence_buffer(struct oss_stream *stream, BYTE *buffer, UINT32 frames)
{
WAVEFORMATEXTENSIBLE *fmtex = (WAVEFORMATEXTENSIBLE*)stream->fmt;
@@ -989,6 +1007,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_endpoint_ids,
create_stream,
release_stream,
+ start,
timer_loop,
is_format_supported,
get_mix_format,
diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h
index 2902bceb949..7418261282d 100644
--- a/dlls/wineoss.drv/unixlib.h
+++ b/dlls/wineoss.drv/unixlib.h
@@ -90,6 +90,12 @@ struct release_stream_params
HRESULT result;
};
+struct start_params
+{
+ struct oss_stream *stream;
+ HRESULT result;
+};
+
struct timer_loop_params
{
struct oss_stream *stream;
@@ -140,6 +146,7 @@ enum oss_funcs
oss_get_endpoint_ids,
oss_create_stream,
oss_release_stream,
+ oss_start,
oss_timer_loop,
oss_is_format_supported,
oss_get_mix_format,
More information about the wine-cvs
mailing list