[PATCH 1/5] winealsa: Move get_next_packet_size to the unixlib.
Andrew Eikum
aeikum at codeweavers.com
Fri Mar 11 07:53:29 CST 2022
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Thu, Mar 10, 2022 at 08:20:02AM +0000, Huw Davies wrote:
> Signed-off-by: Huw Davies <huw at codeweavers.com>
> ---
> 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,
> };
>
> --
> 2.25.1
>
>
More information about the wine-devel
mailing list