From 15323580f8e10d9883864ef7a87744f1ff8cccd6 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 3 Nov 2015 16:21:53 -0600 Subject: [PATCH] winepulse: In Shared mode, track device position in bytes. Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- dlls/winepulse.drv/mmdevdrv.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 0e2bc08538c..e5ba8697072 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -2207,8 +2207,12 @@ static HRESULT WINAPI AudioClock_GetFrequency(IAudioClock *iface, UINT64 *freq) pthread_mutex_lock(&pulse_lock); hr = pulse_stream_valid(This); - if (SUCCEEDED(hr)) - *freq = This->ss.rate * pa_frame_size(&This->ss); + if (SUCCEEDED(hr)) { + if (This->share == AUDCLNT_SHAREMODE_SHARED) + *freq = This->ss.rate * pa_frame_size(&This->ss); + else + *freq = This->ss.rate; + } pthread_mutex_unlock(&pulse_lock); return hr; } @@ -2233,6 +2237,9 @@ static HRESULT WINAPI AudioClock_GetPosition(IAudioClock *iface, UINT64 *pos, *pos = This->clock_written; + if (This->share == AUDCLNT_SHAREMODE_EXCLUSIVE) + *pos /= pa_frame_size(&This->ss); + /* Make time never go backwards */ if (*pos < This->clock_lastpos) *pos = This->clock_lastpos; @@ -2301,7 +2308,7 @@ static HRESULT WINAPI AudioClock2_GetDevicePosition(IAudioClock2 *iface, { ACImpl *This = impl_from_IAudioClock2(iface); HRESULT hr = AudioClock_GetPosition(&This->IAudioClock_iface, pos, qpctime); - if (SUCCEEDED(hr)) + if (SUCCEEDED(hr) && This->share == AUDCLNT_SHAREMODE_SHARED) *pos /= pa_frame_size(&This->ss); return hr; }