Search Issue Tracker

Fixed in 2021.2.X

Fixed in 2019.4.X, 2020.3.X, 2021.1.X

Votes

2

Found in

2018.4

2019.4.10f1

2020.2

Issue ID

1281833

Regression

No

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

Audio

-

How to reproduce:
1. Open the attached 'MicrophoneSpike.zip' project
2. Set Platform Target to iOS
3. Make sure that 'Development Build' and 'Deep Profiling Support' flags are ticked in the Build Settings
3. Build for iOS and open the Xcode project
4. Deploy Xcode project to an iOS device
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 2021.2):

    In 2021.2.0a6 fixed a performance issue where Microphone.Start would cause CPU spikes on iOS. If the user selects the player setting "Prepare iOS for Recording", these spikes have been eliminated. They will now only occur when switching back-and-forth between a built-in microphone and a Bluetooth microphone. When using "Prepare iOS for Recording", most projects will also want to set "Force iOS Speakers when Recording". On Android, there are still some CPU spikes on both Microphone.Start and Microphone.Stop, but they only reproduce on some devices and are much lower than on iOS. Android part of the issue has been moved here: https://issuetracker.unity3d.com/product/unity/issues/guid/1315745/

  2. Resolution Note (fix version 2021.1):

    Fixed in 2021.1.3f1

  3. Resolution Note (fix version 2020.3):

    Fixed in 2020.3.6f1

  4. Resolution Note (fix version 2019.4):

    In 2019.4.28f fixed a performance issue where Microphone.Start would cause CPU spikes on iOS. If the user selects the player setting "Prepare iOS for Recording", these spikes have been eliminated. They will now only occur when switching back-and-forth between a built-in microphone and a Bluetooth microphone. When using "Prepare iOS for Recording", most projects will also want to set "Force iOS Speakers when Recording".

Comments (3)

  1. kolmichcreations

    Jul 25, 2022 04:47

    Oh my, i really need recording + audio routed to the device speakers (not ear speakers). Can anybody tell me in which version this was working before it was destroyed again by this bugfix?

    Thank you!!

  2. marnsmith

    Dec 09, 2021 19:37

    +1 on the new bug, audio output is back to ear speaker

  3. SniperED007

    Oct 02, 2021 11:35

    This fix causes a new bug... the audio is now ALWAYS forced through the internal speaker (the ear speaker) on iPhone.

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.