From 26d535b58e6c73c78a82469a9fdb76b5f41f8003 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 22 Nov 2019 17:28:02 -0800 Subject: [PATCH] audio VTS: Fix parametrization for compressed formats Compressed formats should not be opened with DIRECT flag only, as this will result in playing out compressed data. Bug: 141989952 Test: atest VtsHalAudioV6_0TargetTest Change-Id: I873f9a25d5109fb9f5d56f5f748d1348dc12d416 --- .../6.0/AudioPrimaryHidlHalTest.cpp | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp index 22e60be380..2afbbb8fc4 100644 --- a/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/6.0/AudioPrimaryHidlHalTest.cpp @@ -83,7 +83,6 @@ const std::vector& getOutputDeviceConfigParameters() { for (auto& config : configs) { // Some combinations of flags declared in the config file require special // treatment. - bool special = false; if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { config.offloadInfo.sampleRateHz = config.sampleRateHz; config.offloadInfo.channelMask = config.channelMask; @@ -94,22 +93,13 @@ const std::vector& getOutputDeviceConfigParameters() { config.offloadInfo.bitWidth = 16; config.offloadInfo.bufferSize = 256; // arbitrary value config.offloadInfo.usage = AudioUsage::MEDIA; - result.emplace_back( - device, config, - AudioOutputFlag(AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)); - special = true; - } - if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) && - !(flags & - (AUDIO_OUTPUT_FLAG_HW_AV_SYNC | AUDIO_OUTPUT_FLAG_MMAP_NOIRQ))) { result.emplace_back(device, config, - AudioOutputFlag(AUDIO_OUTPUT_FLAG_DIRECT)); - special = true; - } - if (flags & AUDIO_OUTPUT_FLAG_PRIMARY) { // ignore the flag - flags &= ~AUDIO_OUTPUT_FLAG_PRIMARY; - } - if (!special) { + AudioOutputFlag(AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD | + AUDIO_OUTPUT_FLAG_DIRECT)); + } else { + if (flags & AUDIO_OUTPUT_FLAG_PRIMARY) { // ignore the flag + flags &= ~AUDIO_OUTPUT_FLAG_PRIMARY; + } result.emplace_back(device, config, AudioOutputFlag(flags)); } }