Huw Davies : winecoreaudio: Move get_next_packet_size to the unixlib.
Alexandre Julliard
julliard at winehq.org
Wed Nov 24 15:17:17 CST 2021
Module: wine
Branch: master
Commit: 5ff056f399beec5f0f1fffca0af1f842ebcbb8d8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=5ff056f399beec5f0f1fffca0af1f842ebcbb8d8
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Nov 24 11:26:44 2021 +0000
winecoreaudio: Move get_next_packet_size to the unixlib.
The capture_resample syscall can now be removed.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winecoreaudio.drv/coreaudio.c | 27 ++++++++++++++++++++++-----
dlls/winecoreaudio.drv/mmdevdrv.c | 22 +++++-----------------
dlls/winecoreaudio.drv/unixlib.h | 10 ++++++++--
3 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c
index d723291bb24..0ed4fcb02fe 100644
--- a/dlls/winecoreaudio.drv/coreaudio.c
+++ b/dlls/winecoreaudio.drv/coreaudio.c
@@ -1068,9 +1068,8 @@ static OSStatus feed_cb(AudioConverterRef converter, UInt32 *nframes, AudioBuffe
return noErr;
}
-static NTSTATUS capture_resample(void *args)
+static void capture_resample(struct coreaudio_stream *stream)
{
- struct coreaudio_stream *stream = args;
UINT32 resamp_period_frames = muldiv(stream->period_frames, stream->dev_desc.mSampleRate,
stream->fmt->nSamplesPerSec);
OSStatus sc;
@@ -1115,7 +1114,6 @@ static NTSTATUS capture_resample(void *args)
}else
stream->held_frames += wanted_frames;
}
- return STATUS_SUCCESS;
}
static NTSTATUS get_buffer_size(void *args)
@@ -1485,6 +1483,26 @@ static NTSTATUS release_capture_buffer(void *args)
return STATUS_SUCCESS;
}
+static NTSTATUS get_next_packet_size(void *args)
+{
+ struct get_next_packet_size_params *params = args;
+ struct coreaudio_stream *stream = params->stream;
+
+ OSSpinLockLock(&stream->lock);
+
+ capture_resample(stream);
+
+ if(stream->held_frames >= stream->period_frames)
+ *params->frames = stream->period_frames;
+ else
+ *params->frames = 0;
+
+ OSSpinLockUnlock(&stream->lock);
+
+ params->result = S_OK;
+ return STATUS_SUCCESS;
+}
+
unixlib_entry_t __wine_unix_call_funcs[] =
{
get_endpoint_ids,
@@ -1502,6 +1520,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
get_buffer_size,
get_latency,
get_current_padding,
-
- capture_resample /* temporary */
+ get_next_packet_size,
};
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c
index cc37bebdc77..b0208ce0a44 100644
--- a/dlls/winecoreaudio.drv/mmdevdrv.c
+++ b/dlls/winecoreaudio.drv/mmdevdrv.c
@@ -683,11 +683,6 @@ static HRESULT get_audio_session(const GUID *sessionguid,
return S_OK;
}
-static void capture_resample(ACImpl *This)
-{
- UNIX_CALL(capture_resample, This->stream);
-}
-
static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
AUDCLNT_SHAREMODE mode, DWORD flags, REFERENCE_TIME duration,
REFERENCE_TIME period, const WAVEFORMATEX *fmt,
@@ -1401,24 +1396,17 @@ static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
IAudioCaptureClient *iface, UINT32 *frames)
{
ACImpl *This = impl_from_IAudioCaptureClient(iface);
+ struct get_next_packet_size_params params;
TRACE("(%p)->(%p)\n", This, frames);
if(!frames)
return E_POINTER;
- OSSpinLockLock(&This->stream->lock);
-
- capture_resample(This);
-
- if(This->stream->held_frames >= This->stream->period_frames)
- *frames = This->stream->period_frames;
- else
- *frames = 0;
-
- OSSpinLockUnlock(&This->stream->lock);
-
- return S_OK;
+ params.stream = This->stream;
+ params.frames = frames;
+ UNIX_CALL(get_next_packet_size, ¶ms);
+ return params.result;
}
static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl =
diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h
index 9bb636fd625..32eb57a866a 100644
--- a/dlls/winecoreaudio.drv/unixlib.h
+++ b/dlls/winecoreaudio.drv/unixlib.h
@@ -166,6 +166,13 @@ struct get_current_padding_params
UINT32 *padding;
};
+struct get_next_packet_size_params
+{
+ struct coreaudio_stream *stream;
+ HRESULT result;
+ UINT32 *frames;
+};
+
enum unix_funcs
{
unix_get_endpoint_ids,
@@ -183,8 +190,7 @@ enum unix_funcs
unix_get_buffer_size,
unix_get_latency,
unix_get_current_padding,
-
- unix_capture_resample /* temporary */
+ unix_get_next_packet_size,
};
extern unixlib_handle_t coreaudio_handle;
More information about the wine-cvs
mailing list