1 /*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #define LOG_TAG "VtsHalDownmixTargetTest"
18 #include <android-base/logging.h>
19
20 #include <audio_utils/ChannelMix.h>
21 #include "EffectHelper.h"
22
23 using namespace android;
24
25 using aidl::android::hardware::audio::common::getChannelCount;
26 using aidl::android::hardware::audio::effect::Descriptor;
27 using aidl::android::hardware::audio::effect::Downmix;
28 using aidl::android::hardware::audio::effect::getEffectTypeUuidDownmix;
29 using aidl::android::hardware::audio::effect::IEffect;
30 using aidl::android::hardware::audio::effect::IFactory;
31 using aidl::android::hardware::audio::effect::Parameter;
32 using android::audio_utils::channels::ChannelMix;
33 using android::hardware::audio::common::testing::detail::TestExecutionTracer;
34
35 // minimal HAL interface version to run downmix data path test
36 constexpr int32_t kMinDataTestHalVersion = 2;
37
38 // Testing for enum values
39 static const std::vector<Downmix::Type> kTypeValues = {ndk::enum_range<Downmix::Type>().begin(),
40 ndk::enum_range<Downmix::Type>().end()};
41
42 // Testing for supported layouts from AudioChannelLayout.h
43 static const std::vector<int32_t> kLayoutValues = {
44 AudioChannelLayout::LAYOUT_STEREO, AudioChannelLayout::LAYOUT_2POINT1,
45 AudioChannelLayout::LAYOUT_TRI, AudioChannelLayout::LAYOUT_TRI_BACK,
46 AudioChannelLayout::LAYOUT_3POINT1, AudioChannelLayout::LAYOUT_2POINT0POINT2,
47 AudioChannelLayout::LAYOUT_2POINT1POINT2, AudioChannelLayout::LAYOUT_3POINT0POINT2,
48 AudioChannelLayout::LAYOUT_3POINT1POINT2, AudioChannelLayout::LAYOUT_QUAD,
49 AudioChannelLayout::LAYOUT_QUAD_SIDE, AudioChannelLayout::LAYOUT_SURROUND,
50 AudioChannelLayout::LAYOUT_PENTA, AudioChannelLayout::LAYOUT_5POINT1,
51 AudioChannelLayout::LAYOUT_5POINT1_SIDE, AudioChannelLayout::LAYOUT_5POINT1POINT2,
52 AudioChannelLayout::LAYOUT_5POINT1POINT4, AudioChannelLayout::LAYOUT_6POINT1,
53 AudioChannelLayout::LAYOUT_7POINT1, AudioChannelLayout::LAYOUT_7POINT1POINT2,
54 AudioChannelLayout::LAYOUT_7POINT1POINT4, AudioChannelLayout::LAYOUT_9POINT1POINT4,
55 AudioChannelLayout::LAYOUT_9POINT1POINT6, AudioChannelLayout::LAYOUT_13POINT_360RA,
56 AudioChannelLayout::LAYOUT_22POINT2};
57
58 static const std::vector<int32_t> kChannels = {
59 AudioChannelLayout::CHANNEL_FRONT_LEFT,
60 AudioChannelLayout::CHANNEL_FRONT_RIGHT,
61 AudioChannelLayout::CHANNEL_FRONT_CENTER,
62 AudioChannelLayout::CHANNEL_LOW_FREQUENCY,
63 AudioChannelLayout::CHANNEL_BACK_LEFT,
64 AudioChannelLayout::CHANNEL_BACK_RIGHT,
65 AudioChannelLayout::CHANNEL_BACK_CENTER,
66 AudioChannelLayout::CHANNEL_SIDE_LEFT,
67 AudioChannelLayout::CHANNEL_SIDE_RIGHT,
68 AudioChannelLayout::CHANNEL_FRONT_LEFT_OF_CENTER,
69 AudioChannelLayout::CHANNEL_FRONT_RIGHT_OF_CENTER,
70 AudioChannelLayout::CHANNEL_TOP_CENTER,
71 AudioChannelLayout::CHANNEL_TOP_FRONT_LEFT,
72 AudioChannelLayout::CHANNEL_TOP_FRONT_CENTER,
73 AudioChannelLayout::CHANNEL_TOP_FRONT_RIGHT,
74 AudioChannelLayout::CHANNEL_TOP_BACK_LEFT,
75 AudioChannelLayout::CHANNEL_TOP_BACK_CENTER,
76 AudioChannelLayout::CHANNEL_TOP_BACK_RIGHT,
77 AudioChannelLayout::CHANNEL_TOP_SIDE_LEFT,
78 AudioChannelLayout::CHANNEL_TOP_SIDE_RIGHT,
79 AudioChannelLayout::CHANNEL_BOTTOM_FRONT_LEFT,
80 AudioChannelLayout::CHANNEL_BOTTOM_FRONT_CENTER,
81 AudioChannelLayout::CHANNEL_BOTTOM_FRONT_RIGHT,
82 AudioChannelLayout::CHANNEL_LOW_FREQUENCY_2,
83 AudioChannelLayout::CHANNEL_FRONT_WIDE_LEFT,
84 AudioChannelLayout::CHANNEL_FRONT_WIDE_RIGHT,
85 };
86
87 class DownmixEffectHelper : public EffectHelper {
88 public:
SetUpDownmix(int32_t inputBufferLayout=AudioChannelLayout::LAYOUT_STEREO)89 void SetUpDownmix(int32_t inputBufferLayout = AudioChannelLayout::LAYOUT_STEREO) {
90 ASSERT_NE(nullptr, mFactory);
91 ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
92
93 AudioChannelLayout inputChannelLayout =
94 AudioChannelLayout::make<AudioChannelLayout::layoutMask>(inputBufferLayout);
95
96 Parameter::Specific specific = getDefaultParamSpecific();
97 Parameter::Common common = EffectHelper::createParamCommon(
98 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
99 kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */,
100 inputChannelLayout,
101 AudioChannelLayout::make<AudioChannelLayout::layoutMask>(
102 AudioChannelLayout::LAYOUT_STEREO));
103 ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &mOpenEffectReturn, EX_NONE));
104 ASSERT_NE(nullptr, mEffect);
105 }
106
TearDownDownmix()107 void TearDownDownmix() {
108 ASSERT_NO_FATAL_FAILURE(close(mEffect));
109 ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
110 mOpenEffectReturn = IEffect::OpenEffectReturn{};
111 }
112
createDownmixParam(Downmix::Type type)113 Parameter createDownmixParam(Downmix::Type type) {
114 return Parameter::make<Parameter::specific>(
115 Parameter::Specific::make<Parameter::Specific::downmix>(
116 Downmix::make<Downmix::type>(type)));
117 }
setParameters(Downmix::Type type)118 void setParameters(Downmix::Type type) {
119 // set parameter
120 auto param = createDownmixParam(type);
121 EXPECT_STATUS(EX_NONE, mEffect->setParameter(param)) << param.toString();
122 }
123
validateParameters(Downmix::Type type)124 void validateParameters(Downmix::Type type) {
125 auto leId = Downmix::Id::make<Downmix::Id::commonTag>(Downmix::Tag(Downmix::type));
126 auto id = Parameter::Id::make<Parameter::Id::downmixTag>(leId);
127 // get parameter
128 Parameter getParam;
129 EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
130 auto expectedParam = createDownmixParam(type);
131 EXPECT_EQ(expectedParam, getParam) << "\nexpectedParam:" << expectedParam.toString()
132 << "\ngetParam:" << getParam.toString();
133 }
134
getDefaultParamSpecific()135 Parameter::Specific getDefaultParamSpecific() {
136 Downmix dm = Downmix::make<Downmix::type>(Downmix::Type::STRIP);
137 Parameter::Specific specific = Parameter::Specific::make<Parameter::Specific::downmix>(dm);
138 return specific;
139 }
140
setDataTestParams(int32_t layoutType)141 void setDataTestParams(int32_t layoutType) {
142 mInputBuffer.resize(kBufferSize);
143
144 // Get the number of channels used
145 mInputChannelCount = getChannelCount(
146 AudioChannelLayout::make<AudioChannelLayout::layoutMask>(layoutType));
147
148 // In case of downmix, output is always configured to stereo layout.
149 mOutputBufferSize = (mInputBuffer.size() / mInputChannelCount) * kOutputChannelCount;
150 mOutputBuffer.resize(mOutputBufferSize);
151 }
152
153 // Generate mInputBuffer values between -kMaxDownmixSample to kMaxDownmixSample
generateInputBuffer(size_t position,bool isStrip)154 void generateInputBuffer(size_t position, bool isStrip) {
155 size_t increment;
156 if (isStrip)
157 // Fill input at all the channels
158 increment = 1;
159 else
160 // Fill input at only one channel
161 increment = mInputChannelCount;
162
163 for (size_t i = position; i < mInputBuffer.size(); i += increment) {
164 mInputBuffer[i] =
165 ((static_cast<float>(std::rand()) / RAND_MAX) * 2 - 1) * kMaxDownmixSample;
166 }
167 }
168
isLayoutValid(int32_t inputLayout)169 bool isLayoutValid(int32_t inputLayout) {
170 if (inputLayout & kMaxChannelMask) {
171 return false;
172 }
173 return true;
174 }
175
176 static constexpr long kInputFrameCount = 100, kOutputFrameCount = 100;
177 std::shared_ptr<IFactory> mFactory;
178 Descriptor mDescriptor;
179 std::shared_ptr<IEffect> mEffect;
180 IEffect::OpenEffectReturn mOpenEffectReturn;
181
182 std::vector<float> mInputBuffer;
183 std::vector<float> mOutputBuffer;
184 size_t mInputChannelCount;
185 size_t mOutputBufferSize;
186 static constexpr size_t kBufferSize = 128;
187 static constexpr float kMaxDownmixSample = 1;
188 static constexpr int kOutputChannelCount = 2;
189 // Mask for layouts greater than MAX_INPUT_CHANNELS_SUPPORTED
190 static constexpr int32_t kMaxChannelMask =
191 ~((1 << ChannelMix<AUDIO_CHANNEL_OUT_STEREO>::MAX_INPUT_CHANNELS_SUPPORTED) - 1);
192 };
193
194 /**
195 * Here we focus on specific parameter checking, general IEffect interfaces testing performed in
196 * VtsAudioEffectTargetTest.
197 */
198 enum ParamName { PARAM_INSTANCE_NAME, PARAM_TYPE };
199
200 using DownmixParamTestParam =
201 std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, Downmix::Type>;
202
203 class DownmixParamTest : public ::testing::TestWithParam<DownmixParamTestParam>,
204 public DownmixEffectHelper {
205 public:
DownmixParamTest()206 DownmixParamTest() : mParamType(std::get<PARAM_TYPE>(GetParam())) {
207 std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
208 }
209
SetUp()210 void SetUp() override { SetUpDownmix(); }
211
TearDown()212 void TearDown() override { TearDownDownmix(); }
213
214 const Downmix::Type mParamType;
215 };
216
TEST_P(DownmixParamTest,SetAndGetType)217 TEST_P(DownmixParamTest, SetAndGetType) {
218 ASSERT_NO_FATAL_FAILURE(setParameters(mParamType));
219 ASSERT_NO_FATAL_FAILURE(validateParameters(mParamType));
220 }
221
222 enum FoldParamName { FOLD_INSTANCE_NAME, FOLD_INPUT_LAYOUT, FOLD_TEST_CHANNEL };
223
224 using DownmixDataTestParamFold =
225 std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int32_t>;
226
227 class DownmixFoldDataTest : public ::testing::TestWithParam<DownmixDataTestParamFold>,
228 public DownmixEffectHelper {
229 public:
DownmixFoldDataTest()230 DownmixFoldDataTest() : mInputChannelLayout(std::get<FOLD_INPUT_LAYOUT>(GetParam())) {
231 std::tie(mFactory, mDescriptor) = std::get<FOLD_INSTANCE_NAME>(GetParam());
232 }
233
SetUp()234 void SetUp() override {
235 SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
236 SetUpDownmix(mInputChannelLayout);
237 if (int32_t version;
238 mEffect->getInterfaceVersion(&version).isOk() && version < kMinDataTestHalVersion) {
239 GTEST_SKIP() << "Skipping the data test for version: " << version << "\n";
240 }
241 if (!isLayoutValid(mInputChannelLayout)) {
242 GTEST_SKIP() << "Layout not supported \n";
243 }
244 setDataTestParams(mInputChannelLayout);
245 }
246
TearDown()247 void TearDown() override {
248 SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
249 TearDownDownmix();
250 }
251
checkAtLeft(int32_t position)252 void checkAtLeft(int32_t position) {
253 for (size_t i = 0, j = position; i < mOutputBufferSize;
254 i += kOutputChannelCount, j += mInputChannelCount) {
255 // Validate Left channel has audio
256 if (mInputBuffer[j] != 0) {
257 ASSERT_NE(mOutputBuffer[i], 0);
258 } else {
259 // No change in output when input is 0
260 ASSERT_EQ(mOutputBuffer[i], mInputBuffer[j]);
261 }
262 // Validate Right channel has no audio
263 ASSERT_EQ(mOutputBuffer[i + 1], 0);
264 }
265 }
266
checkAtRight(int32_t position)267 void checkAtRight(int32_t position) {
268 for (size_t i = 0, j = position; i < mOutputBufferSize;
269 i += kOutputChannelCount, j += mInputChannelCount) {
270 // Validate Left channel has no audio
271 ASSERT_EQ(mOutputBuffer[i], 0) << " at " << i;
272 // Validate Right channel has audio
273 if (mInputBuffer[j] != 0) {
274 ASSERT_NE(mOutputBuffer[i + 1], 0) << " at " << i;
275 } else {
276 // No change in output when input is 0
277 ASSERT_EQ(mOutputBuffer[i + 1], mInputBuffer[j]) << " at " << i;
278 }
279 }
280 }
281
checkAtCenter(size_t position)282 void checkAtCenter(size_t position) {
283 for (size_t i = 0, j = position; i < mOutputBufferSize;
284 i += kOutputChannelCount, j += mInputChannelCount) {
285 // Validate both channels have audio
286 if (mInputBuffer[j] != 0) {
287 ASSERT_NE(mOutputBuffer[i], 0);
288 ASSERT_NE(mOutputBuffer[i + 1], 0);
289
290 } else {
291 // No change in output when input is 0
292 ASSERT_EQ(mOutputBuffer[i], mInputBuffer[j]);
293 ASSERT_EQ(mOutputBuffer[i + 1], mInputBuffer[j]);
294 }
295 }
296 }
297
validateOutput(int32_t channel,size_t position)298 void validateOutput(int32_t channel, size_t position) {
299 switch (channel) {
300 case AudioChannelLayout::CHANNEL_FRONT_LEFT:
301 case AudioChannelLayout::CHANNEL_BACK_LEFT:
302 case AudioChannelLayout::CHANNEL_SIDE_LEFT:
303 case AudioChannelLayout::CHANNEL_TOP_FRONT_LEFT:
304 case AudioChannelLayout::CHANNEL_BOTTOM_FRONT_LEFT:
305 case AudioChannelLayout::CHANNEL_TOP_BACK_LEFT:
306 case AudioChannelLayout::CHANNEL_FRONT_WIDE_LEFT:
307 case AudioChannelLayout::CHANNEL_TOP_SIDE_LEFT:
308 checkAtLeft(position);
309 break;
310
311 case AudioChannelLayout::CHANNEL_FRONT_RIGHT:
312 case AudioChannelLayout::CHANNEL_BACK_RIGHT:
313 case AudioChannelLayout::CHANNEL_SIDE_RIGHT:
314 case AudioChannelLayout::CHANNEL_TOP_FRONT_RIGHT:
315 case AudioChannelLayout::CHANNEL_BOTTOM_FRONT_RIGHT:
316 case AudioChannelLayout::CHANNEL_TOP_BACK_RIGHT:
317 case AudioChannelLayout::CHANNEL_FRONT_WIDE_RIGHT:
318 case AudioChannelLayout::CHANNEL_TOP_SIDE_RIGHT:
319 case AudioChannelLayout::CHANNEL_LOW_FREQUENCY_2:
320 checkAtRight(position);
321 break;
322
323 case AudioChannelLayout::CHANNEL_FRONT_CENTER:
324 case AudioChannelLayout::CHANNEL_BACK_CENTER:
325 case AudioChannelLayout::CHANNEL_TOP_FRONT_CENTER:
326 case AudioChannelLayout::CHANNEL_BOTTOM_FRONT_CENTER:
327 case AudioChannelLayout::CHANNEL_FRONT_LEFT_OF_CENTER:
328 case AudioChannelLayout::CHANNEL_FRONT_RIGHT_OF_CENTER:
329 case AudioChannelLayout::CHANNEL_TOP_CENTER:
330 case AudioChannelLayout::CHANNEL_TOP_BACK_CENTER:
331 checkAtCenter(position);
332 break;
333
334 case AudioChannelLayout::CHANNEL_LOW_FREQUENCY:
335 // If CHANNEL_LOW_FREQUENCY_2 is supported
336 if (mInputChannelLayout & AudioChannelLayout::CHANNEL_LOW_FREQUENCY_2) {
337 // Validate that only Left channel has audio
338 checkAtLeft(position);
339 } else {
340 // Validate that both channels have audio
341 checkAtCenter(position);
342 }
343 break;
344 }
345 }
346
getInputChannelLayouts()347 std::set<int32_t> getInputChannelLayouts() {
348 std::set<int32_t> supportedChannels;
349 for (int32_t channel : kChannels) {
350 if ((mInputChannelLayout & channel) == channel) {
351 supportedChannels.insert(channel);
352 }
353 }
354 return supportedChannels;
355 }
356
357 int32_t mInputChannelLayout;
358 };
359
TEST_P(DownmixFoldDataTest,DownmixProcessData)360 TEST_P(DownmixFoldDataTest, DownmixProcessData) {
361 // Set FOLD type parameter
362 ASSERT_NO_FATAL_FAILURE(setParameters(Downmix::Type::FOLD));
363
364 // Get all the channels from input layout
365 std::set<int32_t> supportedChannels = getInputChannelLayouts();
366
367 for (int32_t channel : supportedChannels) {
368 size_t position = std::distance(supportedChannels.begin(), supportedChannels.find(channel));
369 generateInputBuffer(position, false /*isStripe*/);
370 ASSERT_NO_FATAL_FAILURE(
371 processAndWriteToOutput(mInputBuffer, mOutputBuffer, mEffect, &mOpenEffectReturn));
372 validateOutput(channel, position);
373 std::fill(mInputBuffer.begin(), mInputBuffer.end(), 0);
374 }
375 }
376
377 enum StripParamName { STRIP_INSTANCE_NAME, STRIP_INPUT_LAYOUT };
378
379 using DownmixStripDataTestParam =
380 std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int32_t>;
381
382 class DownmixStripDataTest : public ::testing::TestWithParam<DownmixStripDataTestParam>,
383 public DownmixEffectHelper {
384 public:
DownmixStripDataTest()385 DownmixStripDataTest() : mInputChannelLayout(std::get<STRIP_INPUT_LAYOUT>(GetParam())) {
386 std::tie(mFactory, mDescriptor) = std::get<STRIP_INSTANCE_NAME>(GetParam());
387 }
388
SetUp()389 void SetUp() override {
390 SetUpDownmix(mInputChannelLayout);
391 if (int32_t version;
392 mEffect->getInterfaceVersion(&version).isOk() && version < kMinDataTestHalVersion) {
393 GTEST_SKIP() << "Skipping the data test for version: " << version << "\n";
394 }
395 if (!isLayoutValid(mInputChannelLayout)) {
396 GTEST_SKIP() << "Layout not supported \n";
397 }
398 setDataTestParams(mInputChannelLayout);
399 }
400
TearDown()401 void TearDown() override { TearDownDownmix(); }
402
validateOutput()403 void validateOutput() {
404 ASSERT_EQ(kBufferSize, mInputBuffer.size());
405 ASSERT_GE(kBufferSize, mOutputBufferSize);
406 for (size_t i = 0, j = 0; i < kBufferSize && j < mOutputBufferSize;
407 i += mInputChannelCount, j += kOutputChannelCount) {
408 ASSERT_EQ(mOutputBuffer[j], mInputBuffer[i]);
409 ASSERT_EQ(mOutputBuffer[j + 1], mInputBuffer[i + 1]);
410 }
411 }
412
413 int32_t mInputChannelLayout;
414 };
415
TEST_P(DownmixStripDataTest,DownmixProcessData)416 TEST_P(DownmixStripDataTest, DownmixProcessData) {
417 // Set STRIP type parameter
418 ASSERT_NO_FATAL_FAILURE(setParameters(Downmix::Type::STRIP));
419
420 // Generate input buffer, call process and compare outputs
421 generateInputBuffer(0 /*position*/, true /*isStripe*/);
422 ASSERT_NO_FATAL_FAILURE(
423 processAndWriteToOutput(mInputBuffer, mOutputBuffer, mEffect, &mOpenEffectReturn));
424 validateOutput();
425 }
426
427 INSTANTIATE_TEST_SUITE_P(
428 DownmixTest, DownmixParamTest,
429 ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
430 IFactory::descriptor, getEffectTypeUuidDownmix())),
431 testing::ValuesIn(kTypeValues)),
__anon12d9f8e90102(const testing::TestParamInfo<DownmixParamTest::ParamType>& info) 432 [](const testing::TestParamInfo<DownmixParamTest::ParamType>& info) {
433 auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
434 std::string type = std::to_string(static_cast<int>(std::get<PARAM_TYPE>(info.param)));
435 std::string name = getPrefix(descriptor) + "_type_" + type;
436 std::replace_if(
437 name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
438 return name;
439 });
440
441 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DownmixParamTest);
442
443 INSTANTIATE_TEST_SUITE_P(
444 DownmixTest, DownmixFoldDataTest,
445 ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
446 IFactory::descriptor, getEffectTypeUuidDownmix())),
447 testing::ValuesIn(kLayoutValues)),
__anon12d9f8e90302(const testing::TestParamInfo<DownmixFoldDataTest::ParamType>& info) 448 [](const testing::TestParamInfo<DownmixFoldDataTest::ParamType>& info) {
449 auto descriptor = std::get<FOLD_INSTANCE_NAME>(info.param).second;
450 std::string layout = std::to_string(std::get<FOLD_INPUT_LAYOUT>(info.param));
451 std::string name = getPrefix(descriptor) + "_fold_layout_" + layout;
452 std::replace_if(
453 name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
454 return name;
455 });
456
457 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DownmixFoldDataTest);
458
459 INSTANTIATE_TEST_SUITE_P(
460 DownmixTest, DownmixStripDataTest,
461 ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
462 IFactory::descriptor, getEffectTypeUuidDownmix())),
463 testing::ValuesIn(kLayoutValues)),
__anon12d9f8e90502(const testing::TestParamInfo<DownmixStripDataTest::ParamType>& info) 464 [](const testing::TestParamInfo<DownmixStripDataTest::ParamType>& info) {
465 auto descriptor = std::get<STRIP_INSTANCE_NAME>(info.param).second;
466 std::string layout =
467 std::to_string(static_cast<int>(std::get<STRIP_INPUT_LAYOUT>(info.param)));
468 std::string name = getPrefix(descriptor) + "_strip_layout_" + layout;
469 std::replace_if(
470 name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
471 return name;
472 });
473
474 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DownmixStripDataTest);
475
main(int argc,char ** argv)476 int main(int argc, char** argv) {
477 ::testing::InitGoogleTest(&argc, argv);
478 ::testing::UnitTest::GetInstance()->listeners().Append(new TestExecutionTracer());
479 ABinderProcess_setThreadPoolMaxThreadCount(1);
480 ABinderProcess_startThreadPool();
481 return RUN_ALL_TESTS();
482 }
483