If you're an audio perfectionist, you've surely stumbled onto flac, an audio compression format designed to deliver lossless recordings. The file sizes are considerably larger than your average MP3, but the sound quality is unparalleled by lossy compression algorithms. It's not hard to see why audiophiles drift towards flac as their preferred storage medium. Now imagine the latest version of Android is causing stuttering, cracks, pops, and static in the otherwise perfect playback of flac.

Symptoms

Audio players on Android 4.4 through 4.4.2 will produce snaps, crackles, pops (heheh), and various other imperfections during the playback of .flac files. The timing of these disruptions is pretty random and seems to get worse over time. Some devices are more prone to demonstrate this behavior than others. For example, I could barely identify any problems on a Nexus 5, but it was easy to hear on a Nexus 4 and 2012 Nexus 7. Under the hood, the CPU usage will also go up substantially, which can cause some mild warming of the device and faster battery drain.

The Cause

The issue appears to have been caused by migrating to Clang and turning on a feature called ftrapv, which is used to capture integer overflows and reduce the potential for unexpected errors. It's not entirely clear how this change caused the bug, but it may simply add too much overhead for the hardware to maintain a steady playback.

A Fix Is Coming

Unlike so many posts in this series, a fix was found and published by the Android team within days of the first report. However, the timing was a little unfortunate. While the patch was merged into the master branch on November 26th, it was not included in the Android 4.4.2 OTA that rolled out 2 weeks later. It's likely that the fixes originally scheduled for that OTA had already been chosen and put into final testing before this bug was identified. The fix is now part of the master branch, so it will definitely appear in an upcoming update, whenever that is.

Workarounds

Since the problem exists in Android's native flac codec, which is used by most of the music players available, finding an alternative app with its own custom implementation will easily solve the issue. One of the options mentioned is the beta version of VLC for Android. Those in the United States can get an apk to sideload from the VideoLAN nightlies page (and optionally join the beta program) while international users can download it directly from the Play Store.

Update: Neutron has also been recommended. It should be more stable and won't require those in the US to go through the extra steps. Thanks, Arthur Brownlee IV.

Another option might be custom ROMs built from AOSP. It's likely that groups like OmniROM and CyanogenMod have already incorporated the aforementioned patch some time ago. Of course, if you're not already using a 3rd-party rom, this probably isn't a good enough reason to start.

Wrap-Up

Overall, this is pretty good news for audiophiles. A fix is coming and there are perfectly serviceable alternative players that will work in the meantime. The OTA for Android 4.4.2 shipped just about a month ago, so we might even see a fix in the near future.

Thanks, bubbleguuum

Sources: AOSP Issue Tracker, Reddit