From cdd19e3d1c92f233a075939641c9f7022e1c99cd Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Wed, 13 Apr 2022 07:38:46 +0100 Subject: [PATCH] wineoss: Move get_current_padding to the unixlib. Signed-off-by: Huw Davies Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- dlls/wineoss.drv/mmdevdrv.c | 13 +++++-------- dlls/wineoss.drv/oss.c | 13 +++++++++++++ dlls/wineoss.drv/unixlib.h | 8 ++++++++ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 8a2329d1f04..fb71aa7562a 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -827,7 +827,7 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface, UINT32 *numpad) { ACImpl *This = impl_from_IAudioClient3(iface); - struct oss_stream *stream = This->stream; + struct get_current_padding_params params; TRACE("(%p)->(%p)\n", This, numpad); @@ -837,15 +837,12 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface, if(!This->stream) return AUDCLNT_E_NOT_INITIALIZED; - oss_lock(stream); - - *numpad = stream->held_frames; - + params.stream = This->stream; + params.padding = numpad; + OSS_CALL(get_current_padding, ¶ms); TRACE("padding: %u\n", *numpad); - oss_unlock(stream); - - return S_OK; + return params.result; } static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient3 *iface, diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index a80557b2c15..7e716ef4704 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -776,6 +776,18 @@ static NTSTATUS get_latency(void *args) return oss_unlock_result(stream, ¶ms->result, S_OK); } +static NTSTATUS get_current_padding(void *args) +{ + struct get_current_padding_params *params = args; + struct oss_stream *stream = params->stream; + + oss_lock(stream); + + *params->padding = stream->held_frames; + + return oss_unlock_result(stream, ¶ms->result, S_OK); +} + unixlib_entry_t __wine_unix_call_funcs[] = { test_connect, @@ -786,4 +798,5 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_mix_format, get_buffer_size, get_latency, + get_current_padding, }; diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index 9f4c736fe4e..bc88be80db2 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -120,6 +120,13 @@ struct get_latency_params REFERENCE_TIME *latency; }; +struct get_current_padding_params +{ + struct oss_stream *stream; + HRESULT result; + UINT32 *padding; +}; + enum oss_funcs { oss_test_connect, @@ -130,6 +137,7 @@ enum oss_funcs oss_get_mix_format, oss_get_buffer_size, oss_get_latency, + oss_get_current_padding, }; extern unixlib_handle_t oss_handle;