[PATCH 1/5] wineoss: Move get_next_packet_size to the unixlib.

Andrew Eikum aeikum at codeweavers.com
Mon Apr 18 08:54:44 CDT 2022


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>

On Fri, Apr 15, 2022 at 09:40:39PM +0100, Huw Davies wrote:
> Signed-off-by: Huw Davies <huw at codeweavers.com>
> ---
>  dlls/wineoss.drv/mmdevdrv.c | 12 +++++-------
>  dlls/wineoss.drv/oss.c      | 14 ++++++++++++++
>  dlls/wineoss.drv/unixlib.h  |  8 ++++++++
>  3 files changed, 27 insertions(+), 7 deletions(-)
> 
> diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c
> index 80bac1d9ceb..c101d757836 100644
> --- a/dlls/wineoss.drv/mmdevdrv.c
> +++ b/dlls/wineoss.drv/mmdevdrv.c
> @@ -1364,20 +1364,18 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
>          IAudioCaptureClient *iface, UINT32 *frames)
>  {
>      ACImpl *This = impl_from_IAudioCaptureClient(iface);
> -    struct oss_stream *stream = This->stream;
> +    struct get_next_packet_size_params params;
>  
>      TRACE("(%p)->(%p)\n", This, frames);
>  
>      if(!frames)
>          return E_POINTER;
>  
> -    oss_lock(stream);
> -
> -    *frames = stream->held_frames < stream->period_frames ? 0 : stream->period_frames;
> -
> -    oss_unlock(stream);
> +    params.stream = This->stream;
> +    params.frames = frames;
> +    OSS_CALL(get_next_packet_size, &params);
>  
> -    return S_OK;
> +    return params.result;
>  }
>  
>  static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl =
> diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c
> index f1994295618..ffea1bb8338 100644
> --- a/dlls/wineoss.drv/oss.c
> +++ b/dlls/wineoss.drv/oss.c
> @@ -1243,6 +1243,19 @@ static NTSTATUS get_current_padding(void *args)
>      return oss_unlock_result(stream, &params->result, S_OK);
>  }
>  
> +static NTSTATUS get_next_packet_size(void *args)
> +{
> +    struct get_next_packet_size_params *params = args;
> +    struct oss_stream *stream = params->stream;
> +    UINT32 *frames = params->frames;
> +
> +    oss_lock(stream);
> +
> +    *frames = stream->held_frames < stream->period_frames ? 0 : stream->period_frames;
> +
> +    return oss_unlock_result(stream, &params->result, S_OK);
> +}
> +
>  static NTSTATUS set_event_handle(void *args)
>  {
>      struct set_event_handle_params *params = args;
> @@ -1282,5 +1295,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/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h
> index 2f0884b9ac5..a809ad41d3e 100644
> --- a/dlls/wineoss.drv/unixlib.h
> +++ b/dlls/wineoss.drv/unixlib.h
> @@ -186,6 +186,13 @@ struct get_current_padding_params
>      UINT32 *padding;
>  };
>  
> +struct get_next_packet_size_params
> +{
> +    struct oss_stream *stream;
> +    HRESULT result;
> +    UINT32 *frames;
> +};
> +
>  struct set_event_handle_params
>  {
>      struct oss_stream *stream;
> @@ -212,6 +219,7 @@ enum oss_funcs
>      oss_get_buffer_size,
>      oss_get_latency,
>      oss_get_current_padding,
> +    oss_get_next_packet_size,
>      oss_set_event_handle,
>  };
>  
> -- 
> 2.25.1
> 
> 



More information about the wine-devel mailing list