Add support for deep audio buffers
Allow AudioSink to use deep audio buffering when the
source is audio only and its duration is more than
a certain threshold.
This helps improve battery life but implies higher
audio latency.
Change-Id: Ie79915b61c370292f05aabda9779356570e03cbb
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 092b516..25d79d6 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -225,6 +225,10 @@
flags = (audio_output_flags_t)
((flags | AUDIO_OUTPUT_FLAG_DIRECT) & ~AUDIO_OUTPUT_FLAG_FAST);
}
+ // only allow deep buffering for music stream type
+ if (streamType != AUDIO_STREAM_MUSIC) {
+ flags = (audio_output_flags_t)(flags &~AUDIO_OUTPUT_FLAG_DEEP_BUFFER);
+ }
if (!audio_is_output_channel(channelMask)) {
ALOGE("Invalid channel mask");