Andrew Eikum : winepulse: In Shared mode, track device position in bytes.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 4 09:40:40 CST 2015


Module: wine
Branch: master
Commit: 15323580f8e10d9883864ef7a87744f1ff8cccd6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=15323580f8e10d9883864ef7a87744f1ff8cccd6

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Tue Nov  3 16:21:53 2015 -0600

winepulse: In Shared mode, track device position in bytes.

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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;
 }




More information about the wine-cvs mailing list