wineoss: Store the period in 100ns units.

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:47 +01:00 committed by Alexandre Julliard
parent cdd19e3d1c
commit ebfd2e8495
3 changed files with 5 additions and 4 deletions

View File

@ -1120,7 +1120,7 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
if(!This->timer){ if(!This->timer){
if(!CreateTimerQueueTimer(&This->timer, g_timer_q, 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)) WT_EXECUTEINTIMERTHREAD))
ERR("Unable to create period timer: %u\n", GetLastError()); ERR("Unable to create period timer: %u\n", GetLastError());
} }

View File

@ -564,7 +564,7 @@ static NTSTATUS create_stream(void *args)
} }
stream->fmt = &fmtex->Format; 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->period_frames = muldiv(params->fmt->nSamplesPerSec, params->period, 10000000);
stream->bufsize_frames = muldiv(params->duration, params->fmt->nSamplesPerSec, 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 /* pretend we process audio in Period chunks, so max latency includes
* the period time. Some native machines add .6666ms in shared mode. */ * 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, &params->result, S_OK); return oss_unlock_result(stream, &params->result, S_OK);
} }

View File

@ -30,8 +30,9 @@ struct oss_stream
BOOL playing, mute; BOOL playing, mute;
UINT64 written_frames, last_pos_frames; 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 */ UINT32 oss_bufsize_bytes, lcl_offs_frames; /* offs into local_buffer where valid data starts */
REFERENCE_TIME period;
BYTE *local_buffer, *tmp_buffer; BYTE *local_buffer, *tmp_buffer;
INT32 getbuf_last; /* <0 when using tmp_buffer */ INT32 getbuf_last; /* <0 when using tmp_buffer */