[vlc-commits] wasapi: use vlc_tick_from_frac() to compute the buffer delay

Steve Lhomme git at videolan.org
Tue Sep 25 12:19:56 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 25 10:09:34 2018 +0200| [b22c910dc9c248992b68dd60dbcd3ff6da74f00a] | committer: Steve Lhomme

wasapi: use vlc_tick_from_frac() to compute the buffer delay

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

 modules/audio_output/wasapi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/modules/audio_output/wasapi.c b/modules/audio_output/wasapi.c
index 6a992799d7..85dea69604 100644
--- a/modules/audio_output/wasapi.c
+++ b/modules/audio_output/wasapi.c
@@ -129,14 +129,12 @@ static HRESULT TimeGet(aout_stream_t *s, vlc_tick_t *restrict delay)
         return hr;
     }
 
-    lldiv_t w = lldiv(sys->written, sys->rate);
-    lldiv_t r = lldiv(pos, freq);
+    vlc_tick_t written = vlc_tick_from_frac(sys->written, sys->rate);
+    vlc_tick_t tick_pos = vlc_tick_from_frac(pos, freq);
 
     static_assert((10000000 % CLOCK_FREQ) == 0, "Frequency conversion broken");
 
-    *delay = vlc_tick_from_sec(w.quot - r.quot)
-           + (vlc_tick_from_sec(w.rem) / sys->rate)
-           - (vlc_tick_from_sec(r.rem) / freq)
+    *delay = written - tick_pos
            - VLC_TICK_FROM_MSFTIME(GetQPC() - qpcpos);
 
     return hr;



More information about the vlc-commits mailing list