From ebfd2e84954e4da13f9c48fad1e229bef7677e6b Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Wed, 13 Apr 2022 07:38:47 +0100 Subject: [PATCH] wineoss: Store the period in 100ns units. Signed-off-by: Huw Davies Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- dlls/wineoss.drv/mmdevdrv.c | 2 +- dlls/wineoss.drv/oss.c | 4 ++-- dlls/wineoss.drv/unixlib.h | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index fb71aa7562a..e61c3c95df2 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -1120,7 +1120,7 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) if(!This->timer){ if(!CreateTimerQueueTimer(&This->timer, g_timer_q, - oss_period_callback, This, 0, stream->period_us / 1000, + oss_period_callback, This, 0, stream->period / 10000, WT_EXECUTEINTIMERTHREAD)) ERR("Unable to create period timer: %u\n", GetLastError()); } diff --git a/dlls/wineoss.drv/oss.c b/dlls/wineoss.drv/oss.c index 7e716ef4704..b00925d6e9b 100644 --- a/dlls/wineoss.drv/oss.c +++ b/dlls/wineoss.drv/oss.c @@ -564,7 +564,7 @@ static NTSTATUS create_stream(void *args) } stream->fmt = &fmtex->Format; - stream->period_us = params->period / 10; + stream->period = params->period; stream->period_frames = muldiv(params->fmt->nSamplesPerSec, params->period, 10000000); stream->bufsize_frames = muldiv(params->duration, params->fmt->nSamplesPerSec, 10000000); @@ -771,7 +771,7 @@ static NTSTATUS get_latency(void *args) /* 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; + *params->latency = stream->period + 6666; return oss_unlock_result(stream, ¶ms->result, S_OK); } diff --git a/dlls/wineoss.drv/unixlib.h b/dlls/wineoss.drv/unixlib.h index bc88be80db2..64c954cc769 100644 --- a/dlls/wineoss.drv/unixlib.h +++ b/dlls/wineoss.drv/unixlib.h @@ -30,8 +30,9 @@ struct oss_stream BOOL playing, mute; UINT64 written_frames, last_pos_frames; - UINT32 period_us, period_frames, bufsize_frames, held_frames, tmp_buffer_frames, in_oss_frames; + UINT32 period_frames, bufsize_frames, held_frames, tmp_buffer_frames, in_oss_frames; UINT32 oss_bufsize_bytes, lcl_offs_frames; /* offs into local_buffer where valid data starts */ + REFERENCE_TIME period; BYTE *local_buffer, *tmp_buffer; INT32 getbuf_last; /* <0 when using tmp_buffer */