Not signed in
Copyright © 2026 Unity Technologies
Added support for Android's AAudio engine, so on Android 8.1 and later, Unity Audio is now layered over AAudio. This fixes 4 audio bugs, related to built-in stereo speaker output, built-in vs. Bluetooth microphone selection, Microphone.Start and Microphone.Stop CPU spikes, and low-latency audio output.
In Android OpenSL and AudioTrack, we aren't allowed to mix directly in the audio data callback. This means we have to create a separate audio mixer thread to do our work. On Android, apps cannot create high-priority threads, so our mixer thread is at the mercy of each device's thread scheduler, and sometimes it does not run frequently enough to support a small audio buffer size. This is why "Best Latency" does not work on all devices. We've fixed this bug in Unity 2023.1 by implementing Android AAudio support, which works on Android 8.1 and later (which is currently 85-90% of Android devices). In our AAudio implementation, we are mixing right in the callback, so we do not have this same buffering problem. We are not planning to back-port this change because it is new functionality and it is risky. AAudio has its own set of challenges and we are focusing on making it as robust as possible as 2023.1 matures. One work-around is to just leave the DSP Buffer Size set to the default of "Best Performance". In our testing, this does appear to be enough buffering to be well-supported across all Android devices, with their varying native buffer sizes and varying thread scheduling behaviour.
In Android OpenSL and AudioTrack, we aren't allowed to mix directly in the audio data callback. This means we have to create a separate audio mixer thread to do our work. On Android, apps cannot create high-priority threads, so our mixer thread is at the mercy of each device's thread scheduler, and sometimes it does not run frequently enough to support a small audio buffer size. This is why "Best Latency" does not work on all devices. We've fixed this bug in Unity 2023.1 by implementing Android AAudio support, which works on Android 8.1 and later (which is currently 85-90% of Android devices). In our AAudio implementation, we are mixing right in the callback, so we do not have this same buffering problem. We are not planning to back-port this change because it is new functionality and it is risky. AAudio has its own set of challenges and we are focusing on making it as robust as possible as 2023.1 matures. One work-around is to just leave the DSP Buffer Size set to the default of "Best Performance". In our testing, this does appear to be enough buffering to be well-supported across all Android devices, with their varying native buffer sizes and varying thread scheduling behaviour.
In Android OpenSL and AudioTrack, we aren't allowed to mix directly in the audio data callback. This means we have to create a separate audio mixer thread to do our work. On Android, apps cannot create high-priority threads, so our mixer thread is at the mercy of each device's thread scheduler, and sometimes it does not run frequently enough to support a small audio buffer size. This is why "Best Latency" does not work on all devices. We've fixed this bug in Unity 2023.1 by implementing Android AAudio support, which works on Android 8.1 and later (which is currently 85-90% of Android devices). In our AAudio implementation, we are mixing right in the callback, so we do not have this same buffering problem. We are not planning to back-port this change because it is new functionality and it is risky. AAudio has its own set of challenges and we are focusing on making it as robust as possible as 2023.1 matures. One work-around is to just leave the DSP Buffer Size set to the default of "Best Performance". In our testing, this does appear to be enough buffering to be well-supported across all Android devices, with their varying native buffer sizes and varying thread scheduling behaviour.
Reproduction steps:
1. Open the attached user's project "BestLatencyAudioRepro.zip"
2. Switch the Platform to Android
3. Connect a OnePlus 7 Pro Device
4. Build and Run for Android
Expected result: When DSP Buffer Size is set to 'Best latency' the audio does not play significantly slower and is not crackling on OnePlus 7 Pro
Actual result: When DSP Buffer Size is set to 'Best latency' the audio plays significantly slower and is crackling on OnePlus 7 Pro
Reproducible with these devices:
VLNQA00318, Oneplus 7Pro (GM1913), Android 10, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640
Not reproducible with these devices:
N/A, Samsung Galaxy S9 (SM-G960F), Android 8.0.0, CPU: Exynos 9 Series 9810, GPU: Mali-G72
VLNQA00231, Huawei HUAWEI Mate 20 Pro (LYA-L29), Android 9, CPU: HiSilicon Kirin 980, GPU: Mali-G76
VLNQA00362, Samsung Galaxy Z Fold2 5G (SM-F916U1), Android 11, CPU: Snapdragon 865 SM8250, GPU: Adreno (TM) 650
VLNQA00024, Xiaomi Mi 5 (MI 5), Android 7.0, CPU: Snapdragon 820 MSM8996, GPU: Adreno (TM) 530
VLNQA00332, Samsung Galaxy XCover4 (SM-G390F), Android 9, CPU: Exynos 7 Quad 7570, GPU: Mali-T720
N/A, Xiaomi - (Redmi Note 8 Pro), Android 9, CPU: MediaTek Helios G90T MT6785T, GPU: Mali-G76 MC4
VLNQA00004, Meizu MX5 (MX5), Android 5.0.1, CPU: MediaTek Helio X10 MT6795T, GPU: PowerVR Rogue G6200
VLNQA00099, Google Pixel XL (Pixel XL), Android 10, CPU: Snapdragon 821 MSM8996 Pro, GPU: Adreno (TM) 530
VLNQA00052, Xiaomi MI MAX (MI MAX), Android 7.0, CPU: Snapdragon 617 MSM8952, GPU: Adreno (TM) 510
iPad 9.7" 6th gen (14.4)
iPad Air 2 (11.0.3)
Reproduces on: 2019.4.28f1, 2020.3.11f1, 2021.1.11f1, 2021.2.0a19
Could not test on 2018.4.35f1 due to project breaking when downgrading
Notes:
-Android logcat is attached "oneplus7pro_logcat.txt"
-Only the "Best Latency" option causes the issue
-Issue does not reproduce on Windows Standalone
Sign in to see your voted issues