From b80de7bcd7c5138d483e60c1fe5b3073a989c3af Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 27 Dec 2023 14:13:31 -0800 Subject: [PATCH 1/2] audio: Add test configs for effects VTS tests The main purpose of the config is to shut down the framework audioserver while the VTS test is running. This is achieved by setting 'vts.native_server.on' to '1'. Without this, restarts of the effects HAL process which are a normal part of tests affect the audioserver and may lead to failures of framework tests that run interleaved with these VTS tests. Bug: 264712385 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts Change-Id: I2515cb62e46ef8e93cbddb2c0219f4523d2ecda5 --- audio/aidl/vts/Android.bp | 2 +- ...CoreTargetTest.xml => VtsHalAudioTargetTestTemplate.xml} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename audio/aidl/vts/{VtsHalAudioCoreTargetTest.xml => VtsHalAudioTargetTestTemplate.xml} (86%) diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 9b0e233261..85319ec1b0 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -36,6 +36,7 @@ cc_defaults { "-Werror", "-Wthread-safety", ], + test_config_template: "VtsHalAudioTargetTestTemplate.xml", test_suites: [ "general-tests", "vts", @@ -71,7 +72,6 @@ cc_test { "VtsHalAudioCoreConfigTargetTest.cpp", "VtsHalAudioCoreModuleTargetTest.cpp", ], - test_config: "VtsHalAudioCoreTargetTest.xml", } cc_test { diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.xml b/audio/aidl/vts/VtsHalAudioTargetTestTemplate.xml similarity index 86% rename from audio/aidl/vts/VtsHalAudioCoreTargetTest.xml rename to audio/aidl/vts/VtsHalAudioTargetTestTemplate.xml index 9d3adc1d0f..c92e8520af 100644 --- a/audio/aidl/vts/VtsHalAudioCoreTargetTest.xml +++ b/audio/aidl/vts/VtsHalAudioTargetTestTemplate.xml @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. --> - + From 27719f12e8bf4548fe2db0423e623019b795c805 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 21 Dec 2023 16:10:52 -0800 Subject: [PATCH 2/2] Revert "Add remote submix direct paths" This reverts commit ce9767a966c9c921e7507985d32ae60e8c6007e8. Please see the comment on aosp/2832731. This configuration leads to anomalous framework behavior. Bug: 311830316 Test: atest audiorouting_tests Change-Id: I5be3ac18819e297aa199c5a0f5d2e85758448b4b --- audio/aidl/default/Configuration.cpp | 46 +++---------------- .../default/r_submix/ModuleRemoteSubmix.cpp | 8 ---- 2 files changed, 6 insertions(+), 48 deletions(-) diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp index baaa55f9b9..2a8e58f843 100644 --- a/audio/aidl/default/Configuration.cpp +++ b/audio/aidl/default/Configuration.cpp @@ -32,7 +32,6 @@ using aidl::android::media::audio::common::AudioDeviceType; using aidl::android::media::audio::common::AudioFormatDescription; using aidl::android::media::audio::common::AudioFormatType; using aidl::android::media::audio::common::AudioGainConfig; -using aidl::android::media::audio::common::AudioInputFlags; using aidl::android::media::audio::common::AudioIoFlags; using aidl::android::media::audio::common::AudioOutputFlags; using aidl::android::media::audio::common::AudioPort; @@ -322,25 +321,20 @@ std::unique_ptr getPrimaryConfiguration() { // // Mix ports: // * "r_submix output", maximum 10 opened streams, maximum 10 active streams -// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000 +// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000 // * "r_submix input", maximum 10 opened streams, maximum 10 active streams -// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000 -// * "r_submix output direct", DIRECT|IEC958_NONAUDIO, 1 max open, 1 max active -// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000 -// * "r_submix input direct", DIRECT, 1 max open, 1 max active -// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000 - +// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000 // // Routes: -// "r_submix output", "r_submix output direct" -> "Remote Submix Out" -// "Remote Submix In" -> "r_submix input", "r_submix input direct" +// "r_submix output" -> "Remote Submix Out" +// "Remote Submix In" -> "r_submix input" // std::unique_ptr getRSubmixConfiguration() { static const Configuration configuration = []() { Configuration c; const std::vector remoteSubmixPcmAudioProfiles{ createProfile(PcmType::INT_16_BIT, {AudioChannelLayout::LAYOUT_STEREO}, - {8000, 11025, 16000, 32000, 44100, 48000, 192000})}; + {8000, 11025, 16000, 32000, 44100, 48000})}; // Device ports @@ -365,41 +359,13 @@ std::unique_ptr getRSubmixConfiguration() { rsubmixOutMix.profiles = remoteSubmixPcmAudioProfiles; c.ports.push_back(rsubmixOutMix); - // Adding a DIRECT flag to rsubmixInMix breaks the mixer paths, so we need separate - // non direct and direct paths. It is added because for IEC61937 encapsulated over PCM, we - // need the DIRECT and IEC958_NONAUDIO flags as AudioFlinger adds them. - AudioPort rsubmixOutDirectMix = - createPort(c.nextPortId++, "r_submix output direct", - makeBitPositionFlagMask({ - AudioOutputFlags::DIRECT, - AudioOutputFlags::IEC958_NONAUDIO}), - false /* isInput */, - createPortMixExt(1 /* maxOpenStreamCount */, - 1 /* maxActiveStreamCount */)); - rsubmixOutDirectMix.profiles = remoteSubmixPcmAudioProfiles; - c.ports.push_back(rsubmixOutDirectMix); - AudioPort rsubmixInMix = createPort(c.nextPortId++, "r_submix input", 0, true, createPortMixExt(10, 10)); rsubmixInMix.profiles = remoteSubmixPcmAudioProfiles; c.ports.push_back(rsubmixInMix); - // Adding a DIRECT flag to rsubmixInMix breaks the capture paths, so we need separate - // non direct and direct paths. It is added because for IEC61937 encapsulated over PCM, we - // need the DIRECT flag for the capability so AudioFlinger can find a DIRECT input match. - AudioPort rsubmixInDirectMix = - createPort(c.nextPortId++, "r_submix input direct", - makeBitPositionFlagMask({AudioInputFlags::DIRECT}), - true /* isInput */, - createPortMixExt(1 /* maxOpenStreamCount */, - 1 /* maxActiveStreamCount */)); - rsubmixInDirectMix.profiles = remoteSubmixPcmAudioProfiles; - c.ports.push_back(rsubmixInDirectMix); - - c.routes.push_back(createRoute( - {rsubmixOutMix, rsubmixOutDirectMix}, rsubmixOutDevice)); + c.routes.push_back(createRoute({rsubmixOutMix}, rsubmixOutDevice)); c.routes.push_back(createRoute({rsubmixInDevice}, rsubmixInMix)); - c.routes.push_back(createRoute({rsubmixInDevice}, rsubmixInDirectMix)); return c; }(); diff --git a/audio/aidl/default/r_submix/ModuleRemoteSubmix.cpp b/audio/aidl/default/r_submix/ModuleRemoteSubmix.cpp index 47ade4981f..7bc783c5b1 100644 --- a/audio/aidl/default/r_submix/ModuleRemoteSubmix.cpp +++ b/audio/aidl/default/r_submix/ModuleRemoteSubmix.cpp @@ -90,10 +90,6 @@ ndk::ScopedAStatus ModuleRemoteSubmix::setAudioPortConfig(const AudioPortConfig& ndk::ScopedAStatus ModuleRemoteSubmix::createInputStream( StreamContext&& context, const SinkMetadata& sinkMetadata, const std::vector& microphones, std::shared_ptr* result) { - if (context.getFormat().type != AudioFormatType::PCM) { - LOG(DEBUG) << __func__ << ": not supported for format " << context.getFormat().toString(); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); - } return createStreamInstance(result, std::move(context), sinkMetadata, microphones); } @@ -101,10 +97,6 @@ ndk::ScopedAStatus ModuleRemoteSubmix::createInputStream( ndk::ScopedAStatus ModuleRemoteSubmix::createOutputStream( StreamContext&& context, const SourceMetadata& sourceMetadata, const std::optional& offloadInfo, std::shared_ptr* result) { - if (context.getFormat().type != AudioFormatType::PCM) { - LOG(DEBUG) << __func__ << ": not supported for format " << context.getFormat().toString(); - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); - } return createStreamInstance(result, std::move(context), sourceMetadata, offloadInfo); }