Android Audio 0.5 second delay fix

Create issue
Issue #143 new
Miku AuahDark created an issue

Changing device->NumUpdates to 1 in ALc.c (line 3110) seems fix the 0.5 second audio delay in Android. Tested in Android 4.2.2 and audio delay is gone.

diff --git a/jni/openal-soft-1.17.0/Alc/ALc.c b/jni/openal-soft-1.17.0/Alc/ALc.c
index f7f7b63..1502056 100644
--- a/jni/openal-soft-1.17.0/Alc/ALc.c
+++ b/jni/openal-soft-1.17.0/Alc/ALc.c
@@ -3107,7 +3107,12 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
     device->FmtChans = DevFmtChannelsDefault;
     device->FmtType = DevFmtTypeDefault;
     device->Frequency = DEFAULT_OUTPUT_RATE;
+#ifdef __ANDROID__
+   //Android fix audio delayed
+   device->NumUpdates = 1;
+#else
     device->NumUpdates = 4;
+#endif
     device->UpdateSize = 1024;

     if(!PlaybackBackend.getFactory)

Comments (5)

  1. Martin Felis repo owner

    @AuahDark thanks for diving into the OpenAL code and the report. I would be very curious what side effects this change has and also what the OpenAL Soft people think about it.

  2. Miku AuahDark reporter

    I would be very curious what side effects this change

    It changes the buffer size to ~23ms. At the moment I'm currently testing the OpenAL-soft experimental branch to fix this problem in a better way (with OpenAL-soft dev)

  3. Log in to comment