Commit 58c8cafb authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winecoreaudio: Move release_capture_buffer to the unixlib.

parent d9a2ae56
......@@ -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,
......
......@@ -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, &params);
return params.result;
}
static HRESULT WINAPI AudioCaptureClient_GetNextPacketSize(
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment