Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab269e2f authored by Shunkai Yao's avatar Shunkai Yao Committed by Gerrit Code Review
Browse files

Merge "DownmixProcess: Add tests to validate the downmix process." into main

parents 9820d5d5 f533b509
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -86,6 +86,9 @@ cc_test {
    name: "VtsHalDownmixTargetTest",
    defaults: ["VtsHalAudioTargetTestDefaults"],
    srcs: ["VtsHalDownmixTargetTest.cpp"],
    shared_libs: [
        "libaudioutils",
    ],
}

cc_test {
+28 −0
Original line number Diff line number Diff line
@@ -283,4 +283,32 @@ class EffectHelper {
        }
        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));
    }
};
+383 −57

File changed.

Preview size limit exceeded, changes collapsed.