Bad FLAC codec on Android 11 ROM for /e/OS


Not exactly sure this is related to hardware, but I use a FP3, that upgraded to Android 11 a few days ago thanks to the amazing work of the /e/OS team on OTAs. :wink:

But since the OTA, music players that use the default Android codecs have problems reading my FLAC audio files. More precisely, when I play any FLAC song on such players (I tested both the stock music player and Vanilla Music), the phone remains silent during, say, ten seconds or so (both with headphone and without), and then suddenly it starts playing, right in the middle of the song. Then the song is played normally; but as soon as I switch to a new song, the bug repeats itself, no sound for tens seconds or so.

On the contrary, VLC (that uses its own codecs) still reads FLAC files flawlessly.

Is it a known bug? Is there a known solution to it?

I had issues before with systemside decode (hw or sw decode). Last time I faced that issue with Vorbis, moving the acodec outside hw offload made the system decode again.

I threw a few different flac files at 1.5-r-20221030230467-dev-FP3 and had mixed results - some played, some didn’t, and it didn’t hinge on bitrate/bitdepth/channels/samplingrate as far as I could determine.

Comparing when it fails, it goes into dsp (msm8974_platform - mixer path compress-offload-playback) hw decode when it fails, and uses system sw decode ( when it works.

It did recover after a lot more than 10 sec and goes from offload to sw decode with at first failing files.

repeating error before doing sw decode:
D msm8974_platform: platform_split_snd_device: snd_device(2) num devices(0) new_snd_devices(0)
I msm8974_platform: platform_get_custom_mtmx_params: no matching param with id 0 ip_ch 2 op_ch 2 uc_id 3 snd_dev 2
D audio_hw_primary: enable_audio_route: apply mixer and update path: compress-offload-playback
D audio_route: Apply path: compress-offload-playback
D audio_hw_primary: select_devices: done
D audio_hw_primary: audio_enable_asm_bit_width_enforce_mode: DSP bitwidth feature is disabled.
I adsprpcd: vendor/qcom/proprietary/adsprpc/src/apps_std_imp.c:870: Successfully opened file /vendor/dsp/
I aw8898_startup: enter
E q6asm_callback: cmd = 0x10d98 returned error = 0x2
E q6asm_stream_media_format_block_flac: DSP returned error[ADSP_EBADPARAM]
E msm_compr_send_media_format_block: CMD Format block failed ret -22
E         : msm_compr_configure_dsp_for_playback, failed to send media format block
E audio_hw_primary: start_output_stream: failed /w error cannot set device: Invalid argument

I think thats the line where it recovers, deciding to finnally not offload

D NuPlayer: restartAudio timeUs(69384), dontOffload(1), createDecoder(1)

TL;DR: So flac dsp hw offload is broken for xyz reason.

Last change to audio in FP3 was imho - FP3: Disable ALAC support (48623cff) · Commits · e / devices / android_device_fairphone_FP3 · GitLab (inlining the xml configs as a driveby commit)

1 Like

Thanks for the info.

Is there anything we can do about it?

individually - if you have root, you can edit the xml and make decoding for formats go the sw-decode route at all times.

In the “S” / A12 build the issue no longer surfaces. Didn’t dig into the build tree difference.

You could file a bug for R with your version string (like stable or dev build etc)