hal: correct offload tear down check due to sw effect
This is a subsidiary bug fix of the following incomplete one.
- audio: don't allow track offloaded if there's active sw effect
- Change-Id: Idf76374a3fd721eee595a8a9f6197a47a3c25e1c
CRs-Fixed: 984621
Change-Id: I8997f49560550d4174e1146340e0cd4d33957b24
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index f5fc3f2..34527cb 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1625,16 +1625,22 @@
// 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.
-
- if (((flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) == 0) &&
- !mEffects.isNonOffloadableEffectEnabled()) {
- profile = getProfileForDirectOutput(device,
- samplingRate,
- format,
- channelMask,
- (audio_output_flags_t)flags);
+ //
+ // Supplementary annotation:
+ // For sake of track offload introduced, we need a rollback for both compress offload
+ // and track offload use cases.
+ if ((flags & (AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_DIRECT_PCM)) &&
+ mEffects.isNonOffloadableEffectEnabled()) {
+ ALOGD("non offloadable effect is enabled, try with non direct output");
+ goto non_direct_output;
}
+ profile = getProfileForDirectOutput(device,
+ samplingRate,
+ format,
+ channelMask,
+ (audio_output_flags_t)flags);
+
if (profile != 0) {
if (!(flags & AUDIO_OUTPUT_FLAG_DIRECT_PCM) &&