Domanda

Audio playback has been tested successfully on Samsung Galaxy S3 and HTC One, but is severely broken on an LGE Nexus 4 running Android 4.4. What happens is that perfectly fine audio can be heard for a fraction of a second, then there's a few seconds of silence followed by another short piece of audio, then silence, and so it goes. So it seems like the audio streaming logic ends up in an eternal start-play-underrun-stop loop.

Every second or so I see the following warning logged:

12-09 00:55:56.982  10842-14365/com.soundrop.android W/AudioTrack﹕ releaseBuffer() track 0x7b03f4e0 name=s:176;n:2;f:-1 disabled due to previous underrun, restarting
12-09 00:55:57.583  10842-14367/com.soundrop.android W/AudioTrack﹕ releaseBuffer() track 0x7b03f4e0 name=s:176;n:2;f:-1 disabled due to previous underrun, restarting
12-09 00:55:58.594  10842-14369/com.soundrop.android W/AudioTrack﹕ releaseBuffer() track 0x7b03f4e0 name=s:176;n:2;f:-1 disabled due to previous underrun, restarting
12-09 00:55:59.595  10842-14371/com.soundrop.android W/AudioTrack﹕ releaseBuffer() track 0x7b03f4e0 name=s:176;n:2;f:-1 disabled due to previous underrun, restarting
12-09 00:56:02.047  10842-14379/com.soundrop.android W/AudioTrack﹕ releaseBuffer() track 0x7b03f4e0 name=s:176;n:2;f:-1 disabled due to previous underrun, restarting

This lead me to think about possible audio buffer differences between the devices, so I did some probing:

HTC One (good playback): AudioTrack.getMinBufferSize(44100, STEREO, ENCODING_PCM_16BIT) => 16932
LGE Nexus 4 (bad playback): AudioTrack.getMinBufferSize(44100, STEREO, ENCODING_PCM_16BIT) => 7056

My speculation is that the Deezer Android SDK sets a too small buffer size on this particular device, as it seems to pick a buffer size that is 10x that of the reported minimum size.

UPDATE: Just reproduced the audio stutter on an HTC One running 4.4, where getMinBufferSize() return 16932 (like it did on Android < 4.4). So this issue is clearly not device-specific, but related to OS-specific behavioral changes starting with KitKat.

È stato utile?

Soluzione

This is indeed an issue raised by the Android 4.4 update. Something in the AudioTrack implementation has changed, and caused these underrun issues.

We're currently working on a fix on this problem and we'll release it as soon as possible.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top