Android Audio 0.5 second delay fix

Create issue
Issue #143 closed
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;
     device->NumUpdates = 4;
     device->UpdateSize = 1024;


Comments (6)

  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