From 9e7ee4953ec5ca41a30c178ce778149a86f07b8f Mon Sep 17 00:00:00 2001 From: dhewg Date: Mon, 14 Mar 2011 20:26:35 +0100 Subject: ANDROID: Halve the audio buffer size Also, run into the blocking audio write without sleep. This hopefully fixes audio hickups on slow devices. --- backends/platform/android/android.cpp | 4 +--- backends/platform/android/org/inodes/gus/scummvm/ScummVM.java | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 7731c53873..72810b6fb7 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -286,9 +286,7 @@ void *OSystem_Android::audioThreadFunc(void *arg) { if (written < 0) break; - // sleep a little, prepare the next buffer, and run into the - // blocking AudioTrack.write - nanosleep(&tv_delay, 0); + // prepare the next buffer, and run into the blocking AudioTrack.write } JNI::setAudioStop(); diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java index 0bc5f3ce4c..dfb585518a 100644 --- a/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java +++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVM.java @@ -245,8 +245,8 @@ public abstract class ScummVM implements SurfaceHolder.Callback, Runnable { AudioFormat.CHANNEL_CONFIGURATION_STEREO, AudioFormat.ENCODING_PCM_16BIT); - // ~100ms - int buffer_size_want = (_sample_rate * 2 * 2 / 10) & ~1023; + // ~50ms + int buffer_size_want = (_sample_rate * 2 * 2 / 20) & ~1023; if (_buffer_size < buffer_size_want) { Log.w(LOG_TAG, String.format( -- cgit v1.2.3