The capture_resample syscall can now be removed.
Signed-off-by: Huw Davies huw@codeweavers.com --- 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;
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Wed, Nov 24, 2021 at 11:26:44AM +0000, Huw Davies wrote:
The capture_resample syscall can now be removed.
Signed-off-by: Huw Davies huw@codeweavers.com
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;
2.23.0