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

Commit 56a13ed7 authored by Wonsik Kim's avatar Wonsik Kim
Browse files

vts: adapt to AIDL codecs

Use bufferpool2 and start thread pool before running the tests.

Bug: 251850069
Test: atest VtsHalMediaC2V1_0TargetAudioDecTest
Change-Id: I47dc8846ffb610f6846e166a8b7d887a70545b38
parent 0560d60a
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define LOG_TAG "codec2_hidl_hal_audio_dec_test"

#include <android-base/logging.h>
#include <android/binder_process.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <stdio.h>
@@ -27,6 +28,7 @@
#include <C2BufferPriv.h>
#include <C2Config.h>
#include <C2Debug.h>
#include <codec2/aidl/ParamTypes.h>
#include <codec2/hidl/client.h>

#include "media_c2_hidl_test_common.h"
@@ -88,7 +90,8 @@ class Codec2AudioDecHidlTestBase : public ::testing::Test {

        std::shared_ptr<C2AllocatorStore> store = android::GetCodec2PlatformAllocatorStore();
        CHECK_EQ(store->fetchAllocator(C2AllocatorStore::DEFAULT_LINEAR, &mLinearAllocator), C2_OK);
        mLinearPool = std::make_shared<C2PooledBlockPool>(mLinearAllocator, mBlockPoolId++);
        mLinearPool = std::make_shared<C2PooledBlockPool>(
                mLinearAllocator, mBlockPoolId++, getBufferPoolVer());
        ASSERT_NE(mLinearPool, nullptr);

        std::vector<std::unique_ptr<C2Param>> queried;
@@ -864,5 +867,6 @@ int main(int argc, char** argv) {
    }

    ::testing::InitGoogleTest(&argc, argv);
    ABinderProcess_startThreadPool();
    return RUN_ALL_TESTS();
}
+5 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#define LOG_TAG "codec2_hidl_hal_audio_enc_test"

#include <android-base/logging.h>
#include <android/binder_process.h>
#include <gtest/gtest.h>
#include <hidl/GtestPrinter.h>
#include <stdio.h>
@@ -69,7 +70,8 @@ class Codec2AudioEncHidlTestBase : public ::testing::Test {

        std::shared_ptr<C2AllocatorStore> store = android::GetCodec2PlatformAllocatorStore();
        CHECK_EQ(store->fetchAllocator(C2AllocatorStore::DEFAULT_LINEAR, &mLinearAllocator), C2_OK);
        mLinearPool = std::make_shared<C2PooledBlockPool>(mLinearAllocator, mBlockPoolId++);
        mLinearPool = std::make_shared<C2PooledBlockPool>(
                mLinearAllocator, mBlockPoolId++, getBufferPoolVer());
        ASSERT_NE(mLinearPool, nullptr);

        std::vector<std::unique_ptr<C2Param>> queried;
@@ -775,6 +777,7 @@ int main(int argc, char** argv) {
                std::make_tuple(std::get<0>(params), std::get<1>(params), true, 2));
    }

    ABinderProcess_startThreadPool();
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}
+3 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ cc_library_static {
    name: "VtsHalMediaC2V1_0CommonUtil",
    defaults: [
        "VtsHalTargetTestDefaults",
        "libcodec2-aidl-client-defaults",
        "libcodec2-hidl-client-defaults",
    ],

@@ -29,6 +30,7 @@ cc_defaults {
    name: "VtsHalMediaC2V1_0Defaults",
    defaults: [
        "VtsHalTargetTestDefaults",
        "libcodec2-aidl-client-defaults",
        "libcodec2-hidl-client-defaults",
    ],

@@ -38,6 +40,7 @@ cc_defaults {
    ],

    shared_libs: [
        "libbinder_ndk",
        "libcodec2_client",
    ],
    test_suites: [
+10 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include "media_c2_hidl_test_common.h"

#include <android/hardware/media/c2/1.0/IComponentStore.h>
#include <codec2/aidl/ParamTypes.h>

std::string sResourceDir = "";

@@ -44,6 +45,14 @@ void printUsage(char* me) {
    std::cerr << "\t -h,  --help:   Print usage \n";
}

C2PooledBlockPool::BufferPoolVer getBufferPoolVer() {
    if (::aidl::android::hardware::media::c2::utils::IsSelected()) {
        return C2PooledBlockPool::VER_AIDL2;
    } else {
        return C2PooledBlockPool::VER_HIDL;
    }
}

void parseArgs(int argc, char** argv) {
    int arg;
    int option_index;
+4 −0
Original line number Diff line number Diff line
@@ -17,8 +17,10 @@
#ifndef MEDIA_C2_HIDL_TEST_COMMON_H
#define MEDIA_C2_HIDL_TEST_COMMON_H

#include <C2BufferPriv.h>
#include <C2Component.h>
#include <C2Config.h>
#include <C2PlatformSupport.h>

#include <codec2/hidl/client.h>
#include <getopt.h>
@@ -126,6 +128,8 @@ struct CodecListener : public android::Codec2Client::Listener {
    std::function<void(std::list<std::unique_ptr<C2Work>>& workItems)> callBack;
};

C2PooledBlockPool::BufferPoolVer getBufferPoolVer();

void parseArgs(int argc, char** argv);

// Return all test parameters, a list of tuple of <instance, component>.
Loading