Audio warmup is the time it takes for the audio amplifier circuit in your device to be fully powered and reach its normal operation state. The major contributors to audio warmup time are power management and any "de-pop" logic to stabilize the circuit.
This document describes how to measure audio warmup time and possible ways to decrease warmup time.
AudioFlinger's FastMixer thread automatically measures output warmup
and reports it as part of the output of the dumpsys media.audio_flinger
command.
At warmup, FastMixer calls write()
repeatedly until the time between two write()
s is the amount expected.
FastMixer determines audio warmup by seeing how long a Hardware Abstraction
Layer (HAL) write()
takes to stabilize.
To measure audio warmup, follow these steps for the built-in speaker and wired headphones and at different times after booting. Warmup times are usually different for each output device and right after booting the device:
adb shell dumpsys media.audio_flinger | grep measuredWarmup
You should see output like this:
sampleRate=44100 frameCount=256 measuredWarmup=X ms, warmupCycles=X
The measuredWarmup=X
is X number of milliseconds
it took for the first set of HAL write()
s to complete.
The warmupCycles=X
is how many HAL write requests it took
until the execution time of write()
matches what is expected.
There are currently no tools provided for measuring audio input warmup. However, input warmup time can be estimated by observing the time required for startRecording() to return.
Warmup time can usually be reduced by a combination of:
However, beware of excessive optimization. You may find that you need to tradeoff between low warmup time versus lack of popping at power transitions.