Signed-off-by: Huw Davies huw@codeweavers.com --- dlls/wineoss.drv/mmdevdrv.c | 14 +++++--------- dlls/wineoss.drv/oss.c | 15 +++++++++++++++ dlls/wineoss.drv/unixlib.h | 8 ++++++++ 3 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index a2f75d7a479..8a2329d1f04 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -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); - - /* 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); + params.stream = This->stream; + params.latency = latency; + OSS_CALL(get_latency, ¶ms);
- return S_OK; + return params.result; }
static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface, diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index fdad419abfa..a80557b2c15 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -762,6 +762,20 @@ static NTSTATUS get_buffer_size(void *args) return oss_unlock_result(stream, ¶ms->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, ¶ms->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, }; diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index b57798ef435..9f4c736fe4e 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -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;