Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/winecoreaudio.drv/coreaudio.c | 20 ++++++++++++++++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 16 ++++------------ dlls/winecoreaudio.drv/unixlib.h | 7 +++++++ 3 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index 133ab3da124..5a49a786f48 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1256,12 +1256,32 @@ static NTSTATUS start(void *args) return STATUS_SUCCESS; }
+static NTSTATUS stop(void *args) +{ + struct stop_params *params = args; + struct coreaudio_stream *stream = params->stream; + + OSSpinLockLock(&stream->lock); + + if(!stream->playing) + params->result = S_FALSE; + else{ + stream->playing = FALSE; + 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, + stop, get_mix_format, is_format_supported, get_buffer_size, diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 30858931338..e214a85c0d3 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -1026,24 +1026,16 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) { ACImpl *This = impl_from_IAudioClient3(iface); + struct stop_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 S_FALSE; - } - - This->stream->playing = FALSE; - - OSSpinLockUnlock(&This->stream->lock); - - return S_OK; + params.stream = This->stream; + UNIX_CALL(stop, ¶ms); + return params.result; }
static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index b4e9e5bf950..c3da84c2c7a 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -81,6 +81,12 @@ struct start_params HRESULT result; };
+struct stop_params +{ + struct coreaudio_stream *stream; + HRESULT result; +}; + struct get_mix_format_params { EDataFlow flow; @@ -127,6 +133,7 @@ enum unix_funcs unix_create_stream, unix_release_stream, unix_start, + unix_stop, unix_get_mix_format, unix_is_format_supported, unix_get_buffer_size,
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Tue, Nov 23, 2021 at 07:55:04AM +0000, Huw Davies wrote:
Signed-off-by: Huw Davies huw@codeweavers.com
dlls/winecoreaudio.drv/coreaudio.c | 20 ++++++++++++++++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 16 ++++------------ dlls/winecoreaudio.drv/unixlib.h | 7 +++++++ 3 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index 133ab3da124..5a49a786f48 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1256,12 +1256,32 @@ static NTSTATUS start(void *args) return STATUS_SUCCESS; }
+static NTSTATUS stop(void *args) +{
- struct stop_params *params = args;
- struct coreaudio_stream *stream = params->stream;
- OSSpinLockLock(&stream->lock);
- if(!stream->playing)
params->result = S_FALSE;
- else{
stream->playing = FALSE;
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,
- stop, get_mix_format, is_format_supported, get_buffer_size,
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 30858931338..e214a85c0d3 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -1026,24 +1026,16 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) { ACImpl *This = impl_from_IAudioClient3(iface);
struct stop_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 S_FALSE;
- }
- This->stream->playing = FALSE;
- OSSpinLockUnlock(&This->stream->lock);
- return S_OK;
- params.stream = This->stream;
- UNIX_CALL(stop, ¶ms);
- return params.result;
}
static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index b4e9e5bf950..c3da84c2c7a 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -81,6 +81,12 @@ struct start_params HRESULT result; };
+struct stop_params +{
- struct coreaudio_stream *stream;
- HRESULT result;
+};
struct get_mix_format_params { EDataFlow flow; @@ -127,6 +133,7 @@ enum unix_funcs unix_create_stream, unix_release_stream, unix_start,
- unix_stop, unix_get_mix_format, unix_is_format_supported, unix_get_buffer_size,
-- 2.23.0