DownmixProcess: Add tests to validate the downmix process.
Added methods to set and validate parameters.
Added test to verify multichannel to stereo conversion for STRIP type.
Added test to verify multichannel to stereo conversion for FOLD type.
Bug:314953788
Test: atest VtsHalDownmixTargetTest
Change-Id: I31ee4df3eac6ae42e3e3cabebd1622e860581eab
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 2c8edf2..d813554 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -283,4 +283,32 @@
}
return functor(result);
}
+
+ static void processAndWriteToOutput(std::vector<float>& inputBuffer,
+ std::vector<float>& outputBuffer,
+ const std::shared_ptr<IEffect>& mEffect,
+ IEffect::OpenEffectReturn* mOpenEffectReturn) {
+ // Initialize AidlMessagequeues
+ auto statusMQ = std::make_unique<EffectHelper::StatusMQ>(mOpenEffectReturn->statusMQ);
+ ASSERT_TRUE(statusMQ->isValid());
+ auto inputMQ = std::make_unique<EffectHelper::DataMQ>(mOpenEffectReturn->inputDataMQ);
+ ASSERT_TRUE(inputMQ->isValid());
+ auto outputMQ = std::make_unique<EffectHelper::DataMQ>(mOpenEffectReturn->outputDataMQ);
+ ASSERT_TRUE(outputMQ->isValid());
+
+ // Enabling the process
+ ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::START));
+ ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING));
+
+ // Write from buffer to message queues and calling process
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, inputBuffer));
+
+ // Read the updated message queues into buffer
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(statusMQ, 1, outputMQ,
+ outputBuffer.size(), outputBuffer));
+
+ // Disable the process
+ ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::RESET));
+ ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::IDLE));
+ }
};