summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-09-26 23:48:42 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-26 23:48:42 +0000
commitcc0d24f30e3d2c50a9f0082af64ce7ce3e1e9109 (patch)
treecf09ac82ee8ad5af9d9eed8838c4e55dacf18f06 /services
parent0d5653fa4e66f884ec9f036abe3b9dbdf6ed3084 (diff)
parenta8a4eeb95988e6bb73f7a742c8dd238c1f96c5c4 (diff)
downloadframeworks_av-cc0d24f30e3d2c50a9f0082af64ce7ce3e1e9109.zip
frameworks_av-cc0d24f30e3d2c50a9f0082af64ce7ce3e1e9109.tar.gz
frameworks_av-cc0d24f30e3d2c50a9f0082af64ce7ce3e1e9109.tar.bz2
am a8a4eeb9: Merge "audio policy: favor mixed over direct output for PCM format" into lmp-dev
* commit 'a8a4eeb95988e6bb73f7a742c8dd238c1f96c5c4': audio policy: favor mixed over direct output for PCM format
Diffstat (limited to 'services')
-rw-r--r--services/audiopolicy/AudioPolicyManager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp
index d51ee8e..d0b990f 100644
--- a/services/audiopolicy/AudioPolicyManager.cpp
+++ b/services/audiopolicy/AudioPolicyManager.cpp
@@ -927,13 +927,21 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_DIRECT);
}
+ sp<IOProfile> profile;
+
+ // skip direct output selection if the request can obviously be attached to a mixed output
+ if (audio_is_linear_pcm(format) && samplingRate <= MAX_MIXER_SAMPLING_RATE &&
+ audio_channel_count_from_out_mask(channelMask) <= 2) {
+ goto non_direct_output;
+ }
+
// Do not allow offloading if one non offloadable effect is enabled. This prevents from
// creating an offloaded track and tearing it down immediately after start when audioflinger
// detects there is an active non offloadable effect.
// FIXME: We should check the audio session here but we do not have it in this context.
// This may prevent offloading in rare situations where effects are left active by apps
// in the background.
- sp<IOProfile> profile;
+
if (((flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) == 0) ||
!isNonOffloadableEffectEnabled()) {
profile = getProfileForDirectOutput(device,
@@ -1016,6 +1024,8 @@ audio_io_handle_t AudioPolicyManager::getOutputForDevice(
return output;
}
+non_direct_output:
+
// ignoring channel mask due to downmix capability in mixer
// open a non direct output