Merge "audio: Fix default surround sound config" into main am: 1b5dab3553
am: 3a4100ec40
am: 4eae019584
am: 4491c5c06e
am: cea2c900cb
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2650299 Change-Id: I4302b6f81a438cb3d515fe6ede40bd6a58c2fd0d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
29c30ab75e
5 changed files with 103 additions and 2 deletions
|
@ -3,6 +3,12 @@
|
|||
{
|
||||
"name": "VtsHalAudioCoreTargetTest"
|
||||
},
|
||||
{
|
||||
"name": "VtsHalAudioCoreConfigTargetTest"
|
||||
},
|
||||
{
|
||||
"name": "audio_policy_config_xml_converter_tests"
|
||||
},
|
||||
{
|
||||
"name": "VtsHalAudioEffectFactoryTargetTest"
|
||||
},
|
||||
|
|
|
@ -144,6 +144,50 @@ cc_binary {
|
|||
],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "audio_policy_config_xml_converter_tests",
|
||||
vendor_available: true,
|
||||
defaults: [
|
||||
"latest_android_media_audio_common_types_ndk_static",
|
||||
"latest_android_hardware_audio_core_ndk_static",
|
||||
],
|
||||
shared_libs: [
|
||||
"libaudio_aidl_conversion_common_ndk",
|
||||
"libaudioaidlcommon",
|
||||
"libaudioutils",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libcutils",
|
||||
"libmedia_helper",
|
||||
"libstagefright_foundation",
|
||||
"libutils",
|
||||
"libxml2",
|
||||
],
|
||||
header_libs: [
|
||||
"libaudio_system_headers",
|
||||
"libaudioaidl_headers",
|
||||
"libxsdc-utils",
|
||||
],
|
||||
generated_sources: [
|
||||
"audio_policy_configuration_aidl_default",
|
||||
],
|
||||
generated_headers: [
|
||||
"audio_policy_configuration_aidl_default",
|
||||
],
|
||||
srcs: [
|
||||
"AudioPolicyConfigXmlConverter.cpp",
|
||||
"tests/AudioPolicyConfigXmlConverterTest.cpp",
|
||||
],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Werror",
|
||||
"-Wthread-safety",
|
||||
"-DBACKEND_NDK",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "aidlaudioeffectservice_defaults",
|
||||
defaults: [
|
||||
|
|
|
@ -137,7 +137,7 @@ const SurroundSoundConfig& AudioPolicyConfigXmlConverter::getDefaultSurroundSoun
|
|||
SIMPLE_FORMAT(MEDIA_MIMETYPE_AUDIO_DTS),
|
||||
SIMPLE_FORMAT(MEDIA_MIMETYPE_AUDIO_DTS_HD),
|
||||
SIMPLE_FORMAT(MEDIA_MIMETYPE_AUDIO_DTS_HD_MA),
|
||||
SIMPLE_FORMAT(MEDIA_MIMETYPE_AUDIO_DTS_UHD),
|
||||
SIMPLE_FORMAT(MEDIA_MIMETYPE_AUDIO_DTS_UHD_P1),
|
||||
SIMPLE_FORMAT(MEDIA_MIMETYPE_AUDIO_DTS_UHD_P2),
|
||||
SIMPLE_FORMAT(MEDIA_MIMETYPE_AUDIO_DOLBY_TRUEHD),
|
||||
SIMPLE_FORMAT(MEDIA_MIMETYPE_AUDIO_EAC3_JOC),
|
||||
|
|
|
@ -38,9 +38,10 @@ class AudioPolicyConfigXmlConverter {
|
|||
const ::aidl::android::media::audio::common::AudioHalEngineConfig& getAidlEngineConfig();
|
||||
const SurroundSoundConfig& getSurroundSoundConfig();
|
||||
|
||||
private:
|
||||
// Public for testing purposes.
|
||||
static const SurroundSoundConfig& getDefaultSurroundSoundConfig();
|
||||
|
||||
private:
|
||||
const std::optional<::android::audio::policy::configuration::AudioPolicyConfiguration>&
|
||||
getXsdcConfig() const {
|
||||
return mConverter.getXsdcConfig();
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// #include <memory>
|
||||
// #include <string>
|
||||
// #include <vector>
|
||||
|
||||
#include <android-base/macros.h>
|
||||
#include <gtest/gtest.h>
|
||||
#define LOG_TAG "AudioPolicyConfigXmlConverterTest"
|
||||
#include <log/log.h>
|
||||
|
||||
#include <core-impl/AudioPolicyConfigXmlConverter.h>
|
||||
#include <media/AidlConversionCppNdk.h>
|
||||
|
||||
using aidl::android::hardware::audio::core::internal::AudioPolicyConfigXmlConverter;
|
||||
using aidl::android::media::audio::common::AudioFormatDescription;
|
||||
|
||||
namespace {
|
||||
|
||||
void ValidateAudioFormatDescription(const AudioFormatDescription& format) {
|
||||
auto conv = ::aidl::android::aidl2legacy_AudioFormatDescription_audio_format_t(format);
|
||||
ASSERT_TRUE(conv.ok()) << format.toString();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST(AudioPolicyConfigXmlConverterTest, DefaultSurroundSoundConfigIsValid) {
|
||||
auto config = AudioPolicyConfigXmlConverter::getDefaultSurroundSoundConfig();
|
||||
for (const auto& family : config.formatFamilies) {
|
||||
EXPECT_NO_FATAL_FAILURE(ValidateAudioFormatDescription(family.primaryFormat));
|
||||
SCOPED_TRACE(family.primaryFormat.toString());
|
||||
for (const auto& sub : family.subFormats) {
|
||||
EXPECT_NO_FATAL_FAILURE(ValidateAudioFormatDescription(sub));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue