[vlc-commits] directsound: use an vlc_tick_t variable to call vlc_tick_sleep()

Steve Lhomme git at videolan.org
Wed Sep 19 11:58:12 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Sep 19 10:40:46 2018 +0200| [60fb9f2b9a1a2fdd783a1d146f611d9cb5ed42d8] | committer: Steve Lhomme

directsound: use an vlc_tick_t variable to call vlc_tick_sleep()

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

 modules/audio_output/directsound.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c
index c687dc7b17..d6d1e126a5 100644
--- a/modules/audio_output/directsound.c
+++ b/modules/audio_output/directsound.c
@@ -1117,6 +1117,7 @@ static void * PlayedDataEraser( void * data )
     unsigned long l_bytes1, l_bytes2;
     DWORD i_read;
     int64_t toerase, tosleep;
+    vlc_tick_t ticksleep;
     HRESULT dsresult;
 
     for(;;)
@@ -1141,10 +1142,10 @@ static void * PlayedDataEraser( void * data )
             else
                 tosleep += DS_BUF_SIZE;
             toerase = max;
-            tosleep = ( tosleep / p_sys->i_bytes_per_sample ) * CLOCK_FREQ / p_sys->i_rate;
+            ticksleep = vlc_tick_from_sec( tosleep / p_sys->i_bytes_per_sample ) / p_sys->i_rate;
         }
 
-        tosleep = __MAX( tosleep, VLC_TICK_FROM_MS(20) );
+        ticksleep = __MAX( ticksleep, VLC_TICK_FROM_MS(20) );
         dsresult = IDirectSoundBuffer_Lock( p_sys->p_dsbuffer,
                                             p_sys->i_write,
                                             toerase,
@@ -1176,7 +1177,7 @@ static void * PlayedDataEraser( void * data )
 wait:
         vlc_mutex_unlock(&p_sys->lock);
         vlc_restorecancel(canc);
-        vlc_tick_sleep(tosleep);
+        vlc_tick_sleep(ticksleep);
     }
     return NULL;
 }



More information about the vlc-commits mailing list