Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Tue, Nov 23, 2021 at 07:55:09AM +0000, Huw Davies wrote:
Signed-off-by: Huw Davies huw@codeweavers.com
dlls/winecoreaudio.drv/coreaudio.c | 29 +++++++++++++++++++++++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 32 +++++------------------------- dlls/winecoreaudio.drv/unixlib.h | 8 ++++++++ 3 files changed, 42 insertions(+), 27 deletions(-)
diff --git a/dlls/winecoreaudio.drv/coreaudio.c b/dlls/winecoreaudio.drv/coreaudio.c index ae44b562c22..d723291bb24 100644 --- a/dlls/winecoreaudio.drv/coreaudio.c +++ b/dlls/winecoreaudio.drv/coreaudio.c @@ -1457,6 +1457,34 @@ end: return STATUS_SUCCESS; }
+static NTSTATUS release_capture_buffer(void *args) +{
- struct release_capture_buffer_params *params = args;
- struct coreaudio_stream *stream = params->stream;
- OSSpinLockLock(&stream->lock);
- if(!params->done){
stream->getbuf_last = 0;
params->result = S_OK;
- }else if(!stream->getbuf_last)
params->result = AUDCLNT_E_OUT_OF_ORDER;
- else if(stream->getbuf_last != params->done)
params->result = AUDCLNT_E_INVALID_SIZE;
- else{
stream->written_frames += params->done;
stream->held_frames -= params->done;
stream->lcl_offs_frames += params->done;
stream->lcl_offs_frames %= stream->bufsize_frames;
stream->getbuf_last = 0;
params->result = S_OK;
- }
- OSSpinLockUnlock(&stream->lock);
- return STATUS_SUCCESS;
+}
unixlib_entry_t __wine_unix_call_funcs[] = { get_endpoint_ids, @@ -1468,6 +1496,7 @@ unixlib_entry_t __wine_unix_call_funcs[] = get_render_buffer, release_render_buffer, get_capture_buffer,
- release_capture_buffer, get_mix_format, is_format_supported, get_buffer_size,
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index 84525ac8a53..717e64b2283 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -1386,36 +1386,14 @@ static HRESULT WINAPI AudioCaptureClient_ReleaseBuffer( IAudioCaptureClient *iface, UINT32 done) { ACImpl *This = impl_from_IAudioCaptureClient(iface);
struct release_capture_buffer_params params;
TRACE("(%p)->(%u)\n", This, done);
- OSSpinLockLock(&This->stream->lock);
- if(!done){
This->stream->getbuf_last = 0;
OSSpinLockUnlock(&This->stream->lock);
return S_OK;
- }
- if(!This->stream->getbuf_last){
OSSpinLockUnlock(&This->stream->lock);
return AUDCLNT_E_OUT_OF_ORDER;
- }
- if(This->stream->getbuf_last != done){
OSSpinLockUnlock(&This->stream->lock);
return AUDCLNT_E_INVALID_SIZE;
- }
- This->stream->written_frames += done;
- This->stream->held_frames -= done;
- This->stream->lcl_offs_frames += done;
- This->stream->lcl_offs_frames %= This->stream->bufsize_frames;
- This->stream->getbuf_last = 0;
- OSSpinLockUnlock(&This->stream->lock);
- return S_OK;
- params.stream = This->stream;
- params.done = done;
- UNIX_CALL(release_capture_buffer, ¶ms);
- return params.result;
}
static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize( diff --git a/dlls/winecoreaudio.drv/unixlib.h b/dlls/winecoreaudio.drv/unixlib.h index 2211f1048a3..9bb636fd625 100644 --- a/dlls/winecoreaudio.drv/unixlib.h +++ b/dlls/winecoreaudio.drv/unixlib.h @@ -120,6 +120,13 @@ struct get_capture_buffer_params UINT64 *qpcpos; };
+struct release_capture_buffer_params +{
- struct coreaudio_stream *stream;
- UINT32 done;
- HRESULT result;
+};
struct get_mix_format_params { EDataFlow flow; @@ -170,6 +177,7 @@ enum unix_funcs unix_get_render_buffer, unix_release_render_buffer, unix_get_capture_buffer,
- unix_release_capture_buffer, unix_get_mix_format, unix_is_format_supported, unix_get_buffer_size,
-- 2.23.0