audiopolicy: use deep buffer output by default for music streams
Default disabled. This is enabled by
adb shell setprop audio.deep_buffer.media 1
Applications that use AudioTrack java interface for audio rendering
defaults to primary output as flags indicated as FLAG_NONE. If the
primary output is low latency output, it results higher power
consumption than deep-buffer path if used.
Make the deep buffer output as default option for music streams if
flags are not specified.
It may also be used for testing audio glitches from heavy CPU
or DRM which may cause issues with the FastMixer.
Change-Id: I2afb205c15f73545168a8d1f68b29df01934da88
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 588e620..bab749d 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1352,7 +1352,12 @@
// only allow deep buffering for music stream type
if (stream != AUDIO_STREAM_MUSIC) {
flags = (audio_output_flags_t)(flags &~AUDIO_OUTPUT_FLAG_DEEP_BUFFER);
+ } else if (/* stream == AUDIO_STREAM_MUSIC && */
+ flags == AUDIO_OUTPUT_FLAG_NONE &&
+ property_get_bool("audio.deep_buffer.media", false /* default_value */)) {
+ flags = (audio_output_flags_t)AUDIO_OUTPUT_FLAG_DEEP_BUFFER;
}
+
if (stream == AUDIO_STREAM_TTS) {
flags = AUDIO_OUTPUT_FLAG_TTS;
}