policy-hal : align custom policy with default policy
AudioPolicyManager: Ensure direct output matches exact format
Otherwise AudioFlinger will fail on createTrack.
Change-Id: I8ad8e9a800465b9b167df205f488f1a48b27e527
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index b290aec..f8f8475 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1778,7 +1778,7 @@
// reuse direct output if currently open by the same client
// and configured with same parameters
if ((config->sample_rate == desc->getSamplingRate()) &&
- audio_formats_match(config->format, desc->getFormat()) &&
+ (config->format == desc->getFormat()) &&
(channelMask == desc->getChannelMask()) &&
(session == desc->mDirectClientSession)) {
desc->mDirectOpenCount++;
@@ -1815,8 +1815,7 @@
// only accept an output with the requested parameters
if (status != NO_ERROR ||
(config->sample_rate != 0 && config->sample_rate != outputDesc->getSamplingRate()) ||
- (config->format != AUDIO_FORMAT_DEFAULT &&
- !audio_formats_match(config->format, outputDesc->getFormat())) ||
+ (config->format != AUDIO_FORMAT_DEFAULT && config->format != outputDesc->getFormat()) ||
(channelMask != 0 && channelMask != outputDesc->getChannelMask())) {
ALOGV("getOutputForDevice() failed opening direct output: output %d sample rate %d %d,"
"format %d %d, channel mask %04x %04x", output, config->sample_rate,