policy_hal : Ensure direct output is not selected again once rejected.
-Ensure once direct output is rejected, and the stream has
AUDIO_OUTPUT_FLAG_NONE and is not a music stream then primary output
should only be selected.
Change-Id: I0d01ba4c3e492fa0b78c4f5122a7c0ac5e830e9d
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 9008936..4c15fda 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1782,16 +1782,22 @@
// for non direct outputs, only PCM is supported
if (audio_is_linear_pcm(format)) {
- if (forced_deep) {
- flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_DEEP_BUFFER);
- ALOGI("setting force DEEP buffer now ");
- }
// get which output is suitable for the specified stream. The actual
// routing change will happen when startOutput() will be called
SortedVector<audio_io_handle_t> outputs = getOutputsForDevice(device, mOutputs);
// at this stage we should ignore the DIRECT flag as no direct output could be found earlier
flags = (audio_output_flags_t)(flags & ~AUDIO_OUTPUT_FLAG_DIRECT);
+
+ if (forced_deep) {
+ flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_DEEP_BUFFER);
+ ALOGI("setting force DEEP buffer now ");
+ } else if(flags == AUDIO_OUTPUT_FLAG_NONE) {
+ // no deep buffer playback is requested hence fallback to primary
+ flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_PRIMARY);
+ ALOGI("FLAG None hence request for a primary output");
+ }
+
output = selectOutput(outputs, flags, format);
}
ALOGW_IF((output == 0), "getOutput() could not find output for stream %d, samplingRate %d,"