Hi! I have an application which uses fluidsynth to play music via OpenSL ES. It is based on music-synthesizer-for-android, following guidelines specified by Glenn Kasten, Raph, Levien, and Ian Ni-Lewis in High Performance Audio video. Everything was working really nicely until recently, when I got to test the app on Nexus 5 device. I'm experiencing a very fast (couple of seconds) degradation in sound quality, as in, increasing sound glitching until there's nothing but noise playing. A song starts nicely, no glitching, after a few seconds, first glitching is audible and after few more seconds there's only noise. If I pause the song, wait for a moment and then resume, the process repeats itself. Nothing like that happened on a couple of other devices I tested this app on, including both high end and low end devices. I gathered some debug data and compared across devices and I can't find the culprit. The problem exists only on Nexus 5. I'm using the correct 192 frame buffer size (also tried 240 just to be sure) and 48kHz sampling rate. The app has an audio track with elevated priority, OpenSL ES callback runs on it.
Attached are the various debug dumps I gathered, as follows:
- shell ps for media server.
- shell ps for the app.
- Time intervals between OpenSL ES callbacks.You can observe that at the beginning it nicely runs at ~4ms, then there are occasional ~8ms intervals and by the end (when I'm hearing just noise) it's almost exclusively ~8ms.
- Audio flinger dumpsys immediately after launching the song.
- Audio flinger dumpsys after 3 minutes of playing the song.
There are three things I noticed out of the ordinary:
- There are 3 Fast Mixer processes running.
- In audio flinger dump it says there's 1 effect applied, but I haven't applied any in the app itself, on other devices there are no effects.
- My manual OpenSL ES callback interval measurements don't correlate with audio flinger dumpsys statistics.
Any ideas what's going on here? Any help would be greatly appreciated. Thanks in advance.