[vlc-commits] opensles_android: express the OPENSLES_BUFLEN in vlc_tick_t

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


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

opensles_android: express the OPENSLES_BUFLEN in vlc_tick_t

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

 modules/audio_output/opensles_android.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/opensles_android.c b/modules/audio_output/opensles_android.c
index 4a5674c649..57c7856861 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -45,7 +45,7 @@
 JNIEnv *android_getEnv(vlc_object_t *p_obj, const char *psz_thread_name);
 
 #define OPENSLES_BUFFERS 255 /* maximum number of buffers */
-#define OPENSLES_BUFLEN  10   /* ms */
+#define VLC_TICK_FROM_MS(OPENSLES_BUFLEN)  10   /* ms */
 /*
  * 10ms of precision when mesasuring latency should be enough,
  * with 255 buffers we can buffer 2.55s of audio.
@@ -168,7 +168,7 @@ static int TimeGet(audio_output_t* aout, vlc_tick_t* restrict drift)
     if (!started)
         return -1;
 
-    *drift = (CLOCK_FREQ * OPENSLES_BUFLEN * st.count / 1000)
+    *drift = OPENSLES_BUFLEN * st.count
         + vlc_tick_from_samples(sys->samples, sys->rate);
 
     /* msg_Dbg(aout, "latency %"PRId64" ms, %d/%d buffers", *drift / 1000,
@@ -463,7 +463,7 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
 
     /* XXX: rounding shouldn't affect us at normal sampling rate */
     sys->rate = fmt->i_rate;
-    sys->samples_per_buf = OPENSLES_BUFLEN * fmt->i_rate / 1000;
+    sys->samples_per_buf = samples_from_vlc_tick(OPENSLES_BUFLEN, fmt->i_rate);
     sys->buf = vlc_alloc(sys->samples_per_buf * bytesPerSample(), OPENSLES_BUFFERS);
     if (!sys->buf)
         goto error;



More information about the vlc-commits mailing list