Search Issue Tracker

Fixed

Fixed in 2023.1.0a13

Votes

7

Found in

2021.3.3f1

2022.1.3f1

2023.1.0a1

Issue ID

UUM-3732

Regression

No

[Android] Microphone.Start() method invocation causes high ping spikes

Platform Audio

-

How to reproduce:
1. Open the attached 'MicrophoneSpike.zip' project
2. Set Platform Target to Android
3. Make sure that 'Development Build' and 'Deep Profiling Support' flags are ticked in the Build Settings
4. Build and run
5. Attach the Profiler to the Autoconnected Player
6. Press the record button in the Profiler
7. Click the 'Start Recording' button in the launched application
8. Stop recording
9. Search for 'Microphone.StartRecord()' in Profiler

Expected result: There are no spikes in the Profiler when the 'Microphone.StartRecord()' method is called
Actual result: 'Microphone.StartRecord()' method causes about 400ms spikes

Reproducible with: 2018.4.27f1, 2019.4.12f1, 2020.1.8f1, 2020.2.0b6

Reproducible with:
iPad Air 2 (iOS 11.0.3) (352ms)
iPhone 8+ (iOS 12.0) (436ms)
iPhone XR (iOS 13.4.1) (415ms)
iPad 9.7’ 6th gen (iOS 14.2) (398ms)
Huawei HUAWEI Mate 20 Pro (LYA-L29), Android 9, CPU: HiSilicon Kirin 980, GPU: Mali-G76 (130ms IL2CPP, 60ms Mono)
VLNQA00001, Google Pixel 2 (Pixel 2), Android 11, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540 (30ms Mono and IL2CPP)
Oneplus OnePlus 6 (ONEPLUS A6003), Android 10, CPU: Snapdragon 845 SDM845, GPU: Adreno (TM) 630 (50ms Mono and IL2CPP)

Not reproducible with:
VLNQA00012, Samsung Galaxy S6 (SM-G920F), Android 7.0, CPU: Exynos 7 Octa 7420, GPU: Mali-T760 (4ms both Microphone.Start() and Microphone.StartRecord() tested 10 times)
VLNQA00122, Samsung Galaxy S9 (SM-G960F), Android 9, CPU: Exynos 9 Series 9810, GPU: Mali-G72 (20ms both Microphone.Start() and Microphone.StartRecord() tested 10 times)
VLNQA00125, Google Pixel 2 (Pixel 2), Android 8.1.0, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540 (10ms both Microphone.Start() and Microphone.StartRecord() tested 10 times)
VLNQA00321, Xiaomi MI 9 (MI 9), Android 9, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640 (27ms both Microphone.Start() and Microphone.StartRecord() tested 10 times)
VLNQA00013, Samsung Galaxy S6 edge+ (SM-G928F), Android 7.0, CPU: Exynos 7 Octa 7420, GPU: Mali-T760 (5ms)
VLNQA00078, Motorola Nexus 6 (Nexus 6), Android 7.1.1, CPU: Snapdragon 805 APQ8084AB, GPU: Adreno (TM) 420 (20ms)
35465210338 Samsung Galaxy S10 (SM-G975F), Android 10.0, CPU: Exynos 9820 (ARMv8), GPU: Mali-G76 (22 ms)

Notes:
-100% reproduction rate with iOS, and a 60% reproduction rate with Android
-The spike seems worse on iOS, with a range 400ms - 800ms, however it is also present on Android even though the spike is slightly less there with a range of 150ms - 300ms
- Screenshot of the issue is attached in Edit
- When testing Android press the CheckConnectedDevices button in the launched application otherwise it won't start to record

  1. Resolution Note (fix version 2023.1.0a13):

    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.

Comments (1)

  1. paultribbiani

    Feb 20, 2021 16:24

    it's been so long since I last read such a favorable article...
    medicinehatmoving.com/piano-moving.html

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.