wineoss: Move get_latency to the unixlib.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2022-04-13 07:38:45 +01:00 committed by Alexandre Julliard
parent aa9d07e630
commit 984cae317b
3 changed files with 28 additions and 9 deletions

View File

@ -806,7 +806,7 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
REFERENCE_TIME *latency)
{
ACImpl *This = impl_from_IAudioClient3(iface);
struct oss_stream *stream = This->stream;
struct get_latency_params params;
TRACE("(%p)->(%p)\n", This, latency);
@ -816,15 +816,11 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
if(!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
oss_lock(stream);
params.stream = This->stream;
params.latency = latency;
OSS_CALL(get_latency, &params);
/* pretend we process audio in Period chunks, so max latency includes
* the period time. Some native machines add .6666ms in shared mode. */
*latency = (REFERENCE_TIME)stream->period_us * 10 + 6666;
oss_unlock(stream);
return S_OK;
return params.result;
}
static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,

View File

@ -762,6 +762,20 @@ static NTSTATUS get_buffer_size(void *args)
return oss_unlock_result(stream, &params->result, S_OK);
}
static NTSTATUS get_latency(void *args)
{
struct get_latency_params *params = args;
struct oss_stream *stream = params->stream;
oss_lock(stream);
/* pretend we process audio in Period chunks, so max latency includes
* the period time. Some native machines add .6666ms in shared mode. */
*params->latency = (REFERENCE_TIME)stream->period_us * 10 + 6666;
return oss_unlock_result(stream, &params->result, S_OK);
}
unixlib_entry_t __wine_unix_call_funcs[] =
{
test_connect,
@ -771,4 +785,5 @@ unixlib_entry_t __wine_unix_call_funcs[] =
is_format_supported,
get_mix_format,
get_buffer_size,
get_latency,
};

View File

@ -113,6 +113,13 @@ struct get_buffer_size_params
UINT32 *size;
};
struct get_latency_params
{
struct oss_stream *stream;
HRESULT result;
REFERENCE_TIME *latency;
};
enum oss_funcs
{
oss_test_connect,
@ -122,6 +129,7 @@ enum oss_funcs
oss_is_format_supported,
oss_get_mix_format,
oss_get_buffer_size,
oss_get_latency,
};
extern unixlib_handle_t oss_handle;