diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index f1ab4cf7986..56504a8b7b0 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1115,6 +1115,18 @@ static NTSTATUS capture_resample(void *args) return STATUS_SUCCESS; } +static NTSTATUS get_buffer_size(void *args) +{ + struct get_buffer_size_params *params = args; + struct coreaudio_stream *stream = params->stream; + + OSSpinLockLock(&stream->lock); + *params->frames = stream->bufsize_frames; + OSSpinLockUnlock(&stream->lock); + params->result = S_OK; + return STATUS_SUCCESS; +} + unixlib_entry_t __wine_unix_call_funcs[] = { get_endpoint_ids, @@ -1122,6 +1134,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = release_stream, get_mix_format, is_format_supported, + get_buffer_size, capture_resample /* temporary */ }; diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 578312bf4ef..cd33cababd1 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -855,6 +855,7 @@ static HRESULT WINAPI AudioClient_GetBufferSize(IAudioClient3 *iface, UINT32 *frames) { ACImpl *This = impl_from_IAudioClient3(iface); + struct get_buffer_size_params params; TRACE("(%p)->(%p)\n", This, frames); @@ -864,13 +865,10 @@ static HRESULT WINAPI AudioClient_GetBufferSize(IAudioClient3 *iface, if(!This->stream) return AUDCLNT_E_NOT_INITIALIZED; - OSSpinLockLock(&This->stream->lock); - - *frames = This->stream->bufsize_frames; - - OSSpinLockUnlock(&This->stream->lock); - - return S_OK; + params.stream = This->stream; + params.frames = frames; + UNIX_CALL(get_buffer_size, ¶ms); + return params.result; } static HRESULT ca_get_max_stream_latency(ACImpl *This, UInt32 *max) diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index c1762c50e7e..7e08b347b02 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -93,6 +93,13 @@ struct is_format_supported_params HRESULT result; }; +struct get_buffer_size_params +{ + struct coreaudio_stream *stream; + HRESULT result; + UINT32 *frames; +}; + enum unix_funcs { unix_get_endpoint_ids, @@ -100,6 +107,7 @@ enum unix_funcs unix_release_stream, unix_get_mix_format, unix_is_format_supported, + unix_get_buffer_size, unix_capture_resample /* temporary */ };