Direct output support for non-MMAP path
- Dominant language
- C++
- Stars
- 4.1k
- Forks
- 639
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 8
Description
Hi, apologies if this is the wrong issue tracker.
Qualcomm and some OEMs (not supported on Tensor Pixel devices, though) usually provide a special output mix port not having the offload flag (i.e. not the PCM offload support recently added), and not having the MMAP flag either, but a pure direct (PCM-only) output. This output is interesting due to inherently different behaviour of the port, for example no effects, more sample rate / format choices (while MMAP usually has very limited or only one choice on the same device) and sometimes even reconfiguring the output sound card. However, there's currently no public API to access this. Using dlopen() aside of blessed stable APIs is a major pain, and I'd like to get rid of that in the future.
Hence, it'd be awesome if AAudio supported direct output tracks for non-MMAP (MMAP is always direct as far as HAL is concerned, I believe), and an API to query if the created track is indeed direct (audio policy will silently fall back to non-direct, but AudioTrack::flags() & AUDIO_OUTPUT_FLAG_DIRECT is a sufficient check). There's already a public API to query for this since Android Q, only playback is missing. I understand this cannot be properly backported in Oboe, but at least future Android version supports in AAudio and Oboe would be awesome to have.
I think it only requires modifying this: https://cs.android.com/android/platform/superproject/main/+/main:frameworks/av/media/libaaudio/src/legacy/AudioStreamTrack.cpp;l=81;drc=353f31abbc5c72706d1498bb3763f7be2c11abbc
to pass AUDIO_OUTPUT_FLAG_DIRECT (without offload), similar to the offload support that was recently added.
Thanks for considering this request!
Contributor guide
Assessment
This issue has not been assessed yet.