androidopensl

OpenSL ES noise when starting to play new buffer


I am using OpenSL ES to play audio on Android. I am experiencing an issue when one buffer in the playback queue ends and another starts, there is often a slight cracking sound between them.

Is it a known issue? How can I avoid it?


Solution

  • After lots of debugging I found the problem. There was the following message in the logcat output:

    AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 1, track 22050 Hz, output 48000 Hz

    Basically, after changing my playback sample rate to 48000 everything started working properly. It seems the resampler of Android OpenSL ES does not work very well. Right now I am doing the resampling in software to make it 48 kHz and then be able to play it.