[PATCH 3/6] winepulse: In Shared mode, track device position in bytes

Andrew Eikum aeikum at codeweavers.com
Tue Nov 3 16:21:53 CST 2015


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
 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 0e2bc08..e5ba869 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;
 }
-- 
2.6.2





More information about the wine-patches mailing list