Module: wine Branch: master Commit: 08461970172fedd45e9870fb1b0665ff241b326f URL: https://source.winehq.org/git/wine.git/?a=commit;h=08461970172fedd45e9870fb1...
Author: Huw Davies huw@codeweavers.com Date: Thu Mar 10 08:20:02 2022 +0000
winealsa: Move get_next_packet_size to the unixlib.
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Andrew Eikum aeikum@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winealsa.drv/alsa.c | 13 +++++++++++++ dlls/winealsa.drv/mmdevdrv.c | 11 +++++------ dlls/winealsa.drv/unixlib.h | 8 ++++++++ 3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c index 02063fd3374..6234591aae4 100644 --- a/dlls/winealsa.drv/alsa.c +++ b/dlls/winealsa.drv/alsa.c @@ -2082,6 +2082,18 @@ static NTSTATUS get_current_padding(void *args) return alsa_unlock_result(stream, ¶ms->result, S_OK); }
+static NTSTATUS get_next_packet_size(void *args) +{ + struct get_next_packet_size_params *params = args; + struct alsa_stream *stream = params->stream; + + alsa_lock(stream); + + *params->frames = stream->held_frames < stream->mmdev_period_frames ? 0 : stream->mmdev_period_frames; + + return alsa_unlock_result(stream, ¶ms->result, S_OK); +} + static NTSTATUS set_event_handle(void *args) { struct set_event_handle_params *params = args; @@ -2120,5 +2132,6 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_buffer_size, get_latency, get_current_padding, + get_next_packet_size, set_event_handle, }; diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index b50025aa77c..7dacd2606cf 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -1414,20 +1414,19 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize( IAudioCaptureClient *iface, UINT32 *frames) { ACImpl *This = impl_from_IAudioCaptureClient(iface); - struct alsa_stream *stream = This->stream; + struct get_next_packet_size_params params;
TRACE("(%p)->(%p)\n", This, frames);
if(!frames) return E_POINTER;
- alsa_lock(stream); - - *frames = stream->held_frames < stream->mmdev_period_frames ? 0 : stream->mmdev_period_frames; + params.stream = This->stream; + params.frames = frames;
- alsa_unlock(stream); + ALSA_CALL(get_next_packet_size, ¶ms);
- return S_OK; + return params.result; }
static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl = diff --git a/dlls/winealsa.drv/unixlib.h b/dlls/winealsa.drv/unixlib.h index ddca1a3100c..88f4fae4a9e 100644 --- a/dlls/winealsa.drv/unixlib.h +++ b/dlls/winealsa.drv/unixlib.h @@ -187,6 +187,13 @@ struct get_current_padding_params UINT32 *padding; };
+struct get_next_packet_size_params +{ + struct alsa_stream *stream; + HRESULT result; + UINT32 *frames; +}; + struct set_event_handle_params { struct alsa_stream *stream; @@ -212,6 +219,7 @@ enum alsa_funcs alsa_get_buffer_size, alsa_get_latency, alsa_get_current_padding, + alsa_get_next_packet_size, alsa_set_event_handle, };