[vlc-devel] [PATCH] opensles: use 10ms buffers

Rafaël Carré funman at videolan.org
Fri Feb 15 16:24:17 CET 2013


This rounds up to exactly 441 samples with 44.1kHz audio
This avoids a rounding error in drift calculation of 2.31 milliseconds
in the worst case of the buffers queue being full for the specific
case of 44.1kHz audio (such a small error is not significative).

For unknown reasons it also fixes A/V sync issues.
---
 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 d02b21c..4d75bf8 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -42,10 +42,10 @@
 #include <SLES/OpenSLES_Android.h>
 
 #define OPENSLES_BUFFERS 255 /* maximum number of buffers */
-#define OPENSLES_BUFLEN  4   /* ms */
+#define OPENSLES_BUFLEN  10   /* ms */
 /*
- * 4ms of precision when mesasuring latency should be plenty enough,
- * with 255 buffers we can buffer ~1s of audio.
+ * 10ms of precision when mesasuring latency should be enough,
+ * with 255 buffers we can buffer 2.55s of audio.
  */
 
 #define CHECK_OPENSL_ERROR(msg)                \
-- 
1.7.10.4



More information about the vlc-devel mailing list