[vlc-commits] wasapi: handle the QPC as an msftime_t converted with VLC_TICK_FROM_MSFTIME()

Steve Lhomme git at videolan.org
Fri Jul 6 16:07:40 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jun 15 09:32:27 2018 +0200| [64f8a99af9b5f036fc3334132ed43fa1a5e6b018] | committer: Steve Lhomme

wasapi: handle the QPC as an msftime_t converted with VLC_TICK_FROM_MSFTIME()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64f8a99af9b5f036fc3334132ed43fa1a5e6b018
---

 modules/access/wasapi.c       |  4 ++--
 modules/audio_output/wasapi.c | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/access/wasapi.c b/modules/access/wasapi.c
index fbe8271259..98ea1ee217 100644
--- a/modules/access/wasapi.c
+++ b/modules/access/wasapi.c
@@ -57,7 +57,7 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, LPVOID reserved)
     return TRUE;
 }
 
-static UINT64 GetQPC(void)
+static msftime_t GetQPC(void)
 {
     LARGE_INTEGER counter;
 
@@ -325,7 +325,7 @@ static unsigned __stdcall Thread(void *data)
         if (hr != S_OK)
             continue;
 
-        pts = vlc_tick_now() - ((GetQPC() - qpc) / 10);
+        pts = vlc_tick_now() - VLC_TICK_FROM_MSFTIME(GetQPC() - qpc);
 
         es_out_SetPCR(demux->out, pts);
 
diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 14c571f778..ee9baf28e7 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -71,7 +71,7 @@ static BOOL CALLBACK InitFreq(INIT_ONCE *once, void *param, void **context)
 
 static LARGE_INTEGER freq; /* performance counters frequency */
 
-static UINT64 GetQPC(void)
+static msftime_t GetQPC(void)
 {
     LARGE_INTEGER counter;
 
@@ -129,10 +129,10 @@ static HRESULT TimeGet(aout_stream_t *s, vlc_tick_t *restrict delay)
 
     static_assert((10000000 % CLOCK_FREQ) == 0, "Frequency conversion broken");
 
-    *delay = ((w.quot - r.quot) * CLOCK_FREQ)
-           + ((w.rem * CLOCK_FREQ) / sys->rate)
-           - ((r.rem * CLOCK_FREQ) / freq)
-           - ((GetQPC() - qpcpos) / (10000000 / CLOCK_FREQ));
+    *delay = vlc_tick_from_sec(w.quot - r.quot)
+           + (vlc_tick_from_sec(w.rem) / sys->rate)
+           - (vlc_tick_from_sec(r.rem) / freq)
+           - VLC_TICK_FROM_MSFTIME(GetQPC() - qpcpos);
 
     return hr;
 }



More information about the vlc-commits mailing list