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

Commit 6367d583 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7273999 from 02ebd761 to sc-release

Change-Id: Ibe1a94f6ae0021b09b987aa754fb8de7d82494e7
parents 0a0fb73a 02ebd761
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
../../../../../../../build/soong/scripts/system-clang-format
 No newline at end of file
+42 −57
Original line number Diff line number Diff line
@@ -33,11 +33,11 @@
using android::C2AllocatorIon;

#include "media_c2_hidl_test_common.h"
using DecodeTestParameters = std::tuple<std::string, std::string, uint32_t, bool>;
static std::vector<DecodeTestParameters> kDecodeTestParameters;

static std::vector<std::tuple<std::string, std::string, std::string, std::string>>
        kDecodeTestParameters;

static std::vector<std::tuple<std::string, std::string, std::string>> kCsdFlushTestParameters;
using CsdFlushTestParameters = std::tuple<std::string, std::string, bool>;
static std::vector<CsdFlushTestParameters> kCsdFlushTestParameters;

struct CompToURL {
    std::string mime;
@@ -46,36 +46,26 @@ struct CompToURL {
};

std::vector<CompToURL> kCompToURL = {
    {"mp4a-latm",
     "bbb_aac_stereo_128kbps_48000hz.aac", "bbb_aac_stereo_128kbps_48000hz.info"},
    {"mp4a-latm",
     "bbb_aac_stereo_128kbps_48000hz.aac", "bbb_aac_stereo_128kbps_48000hz_multi_frame.info"},
    {"audio/mpeg",
     "bbb_mp3_stereo_192kbps_48000hz.mp3", "bbb_mp3_stereo_192kbps_48000hz.info"},
    {"audio/mpeg",
     "bbb_mp3_stereo_192kbps_48000hz.mp3", "bbb_mp3_stereo_192kbps_48000hz_multi_frame.info"},
    {"3gpp",
     "sine_amrnb_1ch_12kbps_8000hz.amrnb", "sine_amrnb_1ch_12kbps_8000hz.info"},
    {"3gpp",
     "sine_amrnb_1ch_12kbps_8000hz.amrnb", "sine_amrnb_1ch_12kbps_8000hz_multi_frame.info"},
    {"amr-wb",
     "bbb_amrwb_1ch_14kbps_16000hz.amrwb", "bbb_amrwb_1ch_14kbps_16000hz.info"},
    {"amr-wb",
     "bbb_amrwb_1ch_14kbps_16000hz.amrwb", "bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info"},
    {"vorbis",
     "bbb_vorbis_stereo_128kbps_48000hz.vorbis", "bbb_vorbis_stereo_128kbps_48000hz.info"},
    {"opus",
     "bbb_opus_stereo_128kbps_48000hz.opus", "bbb_opus_stereo_128kbps_48000hz.info"},
    {"g711-alaw",
     "bbb_g711alaw_1ch_8khz.raw", "bbb_g711alaw_1ch_8khz.info"},
    {"g711-mlaw",
     "bbb_g711mulaw_1ch_8khz.raw", "bbb_g711mulaw_1ch_8khz.info"},
    {"gsm",
     "bbb_gsm_1ch_8khz_13kbps.raw", "bbb_gsm_1ch_8khz_13kbps.info"},
    {"raw",
     "bbb_raw_1ch_8khz_s32le.raw", "bbb_raw_1ch_8khz_s32le.info"},
    {"flac",
     "bbb_flac_stereo_680kbps_48000hz.flac", "bbb_flac_stereo_680kbps_48000hz.info"},
        {"mp4a-latm", "bbb_aac_stereo_128kbps_48000hz.aac", "bbb_aac_stereo_128kbps_48000hz.info"},
        {"mp4a-latm", "bbb_aac_stereo_128kbps_48000hz.aac",
         "bbb_aac_stereo_128kbps_48000hz_multi_frame.info"},
        {"audio/mpeg", "bbb_mp3_stereo_192kbps_48000hz.mp3", "bbb_mp3_stereo_192kbps_48000hz.info"},
        {"audio/mpeg", "bbb_mp3_stereo_192kbps_48000hz.mp3",
         "bbb_mp3_stereo_192kbps_48000hz_multi_frame.info"},
        {"3gpp", "sine_amrnb_1ch_12kbps_8000hz.amrnb", "sine_amrnb_1ch_12kbps_8000hz.info"},
        {"3gpp", "sine_amrnb_1ch_12kbps_8000hz.amrnb",
         "sine_amrnb_1ch_12kbps_8000hz_multi_frame.info"},
        {"amr-wb", "bbb_amrwb_1ch_14kbps_16000hz.amrwb", "bbb_amrwb_1ch_14kbps_16000hz.info"},
        {"amr-wb", "bbb_amrwb_1ch_14kbps_16000hz.amrwb",
         "bbb_amrwb_1ch_14kbps_16000hz_multi_frame.info"},
        {"vorbis", "bbb_vorbis_stereo_128kbps_48000hz.vorbis",
         "bbb_vorbis_stereo_128kbps_48000hz.info"},
        {"opus", "bbb_opus_stereo_128kbps_48000hz.opus", "bbb_opus_stereo_128kbps_48000hz.info"},
        {"g711-alaw", "bbb_g711alaw_1ch_8khz.raw", "bbb_g711alaw_1ch_8khz.info"},
        {"g711-mlaw", "bbb_g711mulaw_1ch_8khz.raw", "bbb_g711mulaw_1ch_8khz.info"},
        {"gsm", "bbb_gsm_1ch_8khz_13kbps.raw", "bbb_gsm_1ch_8khz_13kbps.info"},
        {"raw", "bbb_raw_1ch_8khz_s32le.raw", "bbb_raw_1ch_8khz_s32le.info"},
        {"flac", "bbb_flac_stereo_680kbps_48000hz.flac", "bbb_flac_stereo_680kbps_48000hz.info"},
};

class LinearBuffer : public C2Buffer {
@@ -212,9 +202,8 @@ class Codec2AudioDecHidlTestBase : public ::testing::Test {
    }
};

class Codec2AudioDecHidlTest
    : public Codec2AudioDecHidlTestBase,
      public ::testing::WithParamInterface<std::tuple<std::string, std::string>> {
class Codec2AudioDecHidlTest : public Codec2AudioDecHidlTestBase,
                               public ::testing::WithParamInterface<TestParameters> {
    void getParams() {
        mInstanceName = std::get<0>(GetParam());
        mComponentName = std::get<1>(GetParam());
@@ -438,10 +427,8 @@ TEST_P(Codec2AudioDecHidlTest, configComp) {
    ASSERT_EQ(mComponent->stop(), C2_OK);
}

class Codec2AudioDecDecodeTest
    : public Codec2AudioDecHidlTestBase,
      public ::testing::WithParamInterface<
              std::tuple<std::string, std::string, std::string, std::string>> {
class Codec2AudioDecDecodeTest : public Codec2AudioDecHidlTestBase,
                                 public ::testing::WithParamInterface<DecodeTestParameters> {
    void getParams() {
        mInstanceName = std::get<0>(GetParam());
        mComponentName = std::get<1>(GetParam());
@@ -452,9 +439,8 @@ TEST_P(Codec2AudioDecDecodeTest, DecodeTest) {
    description("Decodes input file");
    if (mDisableTest) GTEST_SKIP() << "Test is disabled";

    uint32_t streamIndex = std::stoi(std::get<2>(GetParam()));
    ;
    bool signalEOS = !std::get<3>(GetParam()).compare("true");
    uint32_t streamIndex = std::get<2>(GetParam());
    bool signalEOS = std::get<3>(GetParam());
    mTimestampDevTest = true;
    char mURL[512], info[512];
    android::Vector<FrameInfo> Info;
@@ -771,9 +757,8 @@ TEST_P(Codec2AudioDecHidlTest, DecodeTestEmptyBuffersInserted) {
    ASSERT_EQ(mComponent->stop(), C2_OK);
}

class Codec2AudioDecCsdInputTests
    : public Codec2AudioDecHidlTestBase,
      public ::testing::WithParamInterface<std::tuple<std::string, std::string, std::string>> {
class Codec2AudioDecCsdInputTests : public Codec2AudioDecHidlTestBase,
                                    public ::testing::WithParamInterface<CsdFlushTestParameters> {
    void getParams() {
        mInstanceName = std::get<0>(GetParam());
        mComponentName = std::get<1>(GetParam());
@@ -819,7 +804,7 @@ TEST_P(Codec2AudioDecCsdInputTests, CSDFlushTest) {
    ASSERT_EQ(eleStream.is_open(), true);

    bool signalEOS = false;
    bool flushCsd = !std::get<2>(GetParam()).compare("true");
    bool flushCsd = std::get<2>(GetParam());
    ALOGV("sending %d csd data ", numCsds);
    int framesToDecode = numCsds;
    ASSERT_NO_FATAL_FAILURE(decodeNFrames(mComponent, mQueueLock, mQueueCondition, mWorkQueue,
@@ -875,16 +860,16 @@ TEST_P(Codec2AudioDecCsdInputTests, CSDFlushTest) {
}

INSTANTIATE_TEST_SUITE_P(PerInstance, Codec2AudioDecHidlTest, testing::ValuesIn(kTestParameters),
                         android::hardware::PrintInstanceTupleNameToString<>);
                         PrintInstanceTupleNameToString<>);

// DecodeTest with StreamIndex and EOS / No EOS
INSTANTIATE_TEST_SUITE_P(StreamIndexAndEOS, Codec2AudioDecDecodeTest,
                         testing::ValuesIn(kDecodeTestParameters),
                         android::hardware::PrintInstanceTupleNameToString<>);
                         PrintInstanceTupleNameToString<>);

INSTANTIATE_TEST_SUITE_P(CsdInputs, Codec2AudioDecCsdInputTests,
                         testing::ValuesIn(kCsdFlushTestParameters),
                         android::hardware::PrintInstanceTupleNameToString<>);
                         PrintInstanceTupleNameToString<>);

}  // anonymous namespace

@@ -893,18 +878,18 @@ int main(int argc, char** argv) {
    kTestParameters = getTestParameters(C2Component::DOMAIN_AUDIO, C2Component::KIND_DECODER);
    for (auto params : kTestParameters) {
        kDecodeTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "0", "false"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), 0, false));
        kDecodeTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "0", "true"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), 0, true));
        kDecodeTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "1", "false"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), 1, false));
        kDecodeTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "1", "true"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), 1, true));

        kCsdFlushTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "true"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), true));
        kCsdFlushTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "false"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), false));
    }

    ::testing::InitGoogleTest(&argc, argv);
+20 −24
Original line number Diff line number Diff line
@@ -35,8 +35,9 @@ using android::C2AllocatorIon;

#include "media_c2_hidl_test_common.h"

static std::vector<std::tuple<std::string, std::string, std::string, std::string>>
        kEncodeTestParameters;
using EncodeTestParameters = std::tuple<std::string, std::string, bool, int32_t>;

static std::vector<EncodeTestParameters> kEncodeTestParameters;

class LinearBuffer : public C2Buffer {
  public:
@@ -170,9 +171,8 @@ class Codec2AudioEncHidlTestBase : public ::testing::Test {
    }
};

class Codec2AudioEncHidlTest
    : public Codec2AudioEncHidlTestBase,
      public ::testing::WithParamInterface<std::tuple<std::string, std::string>> {
class Codec2AudioEncHidlTest : public Codec2AudioEncHidlTestBase,
                               public ::testing::WithParamInterface<TestParameters> {
    void getParams() {
        mInstanceName = std::get<0>(GetParam());
        mComponentName = std::get<1>(GetParam());
@@ -246,7 +246,8 @@ bool getConfigParams(std::string mime, int32_t* nChannels, int32_t* nSampleRate,
        *nChannels = 1;
        *nSampleRate = 16000;
        *samplesPerFrame = 160;
    } else return false;
    } else
        return false;

    return true;
}
@@ -258,10 +259,8 @@ void Codec2AudioEncHidlTestBase::GetURLForComponent(char* mURL) {
        const char* mURL;
    };
    static const CompToURL kCompToURL[] = {
            {"mp4a-latm", "bbb_raw_2ch_48khz_s16le.raw"},
            {"3gpp", "bbb_raw_1ch_8khz_s16le.raw"},
            {"amr-wb", "bbb_raw_1ch_16khz_s16le.raw"},
            {"flac", "bbb_raw_2ch_48khz_s16le.raw"},
            {"mp4a-latm", "bbb_raw_2ch_48khz_s16le.raw"}, {"3gpp", "bbb_raw_1ch_8khz_s16le.raw"},
            {"amr-wb", "bbb_raw_1ch_16khz_s16le.raw"},    {"flac", "bbb_raw_2ch_48khz_s16le.raw"},
            {"opus", "bbb_raw_2ch_48khz_s16le.raw"},
    };

@@ -363,10 +362,8 @@ TEST_P(Codec2AudioEncHidlTest, validateCompName) {
    ASSERT_EQ(mDisableTest, false);
}

class Codec2AudioEncEncodeTest
    : public Codec2AudioEncHidlTestBase,
      public ::testing::WithParamInterface<
              std::tuple<std::string, std::string, std::string, std::string>> {
class Codec2AudioEncEncodeTest : public Codec2AudioEncHidlTestBase,
                                 public ::testing::WithParamInterface<EncodeTestParameters> {
    void getParams() {
        mInstanceName = std::get<0>(GetParam());
        mComponentName = std::get<1>(GetParam());
@@ -379,9 +376,9 @@ TEST_P(Codec2AudioEncEncodeTest, EncodeTest) {
    char mURL[512];
    strcpy(mURL, sResourceDir.c_str());
    GetURLForComponent(mURL);
    bool signalEOS = !std::get<2>(GetParam()).compare("true");
    bool signalEOS = std::get<2>(GetParam());
    // Ratio w.r.t to mInputMaxBufSize
    int32_t inputMaxBufRatio = std::stoi(std::get<3>(GetParam()));
    int32_t inputMaxBufRatio = std::get<3>(GetParam());

    int32_t nChannels;
    int32_t nSampleRate;
@@ -428,8 +425,7 @@ TEST_P(Codec2AudioEncEncodeTest, EncodeTest) {
        ALOGE("framesReceived : %d inputFrames : %u", mFramesReceived, numFrames);
        ASSERT_TRUE(false);
    }
    if ((mMime.find("flac") != std::string::npos) ||
        (mMime.find("opus") != std::string::npos) ||
    if ((mMime.find("flac") != std::string::npos) || (mMime.find("opus") != std::string::npos) ||
        (mMime.find("mp4a-latm") != std::string::npos)) {
        ASSERT_TRUE(mCsd) << "CSD buffer missing";
    }
@@ -753,13 +749,13 @@ TEST_P(Codec2AudioEncHidlTest, MultiSampleRateTest) {
}

INSTANTIATE_TEST_SUITE_P(PerInstance, Codec2AudioEncHidlTest, testing::ValuesIn(kTestParameters),
                         android::hardware::PrintInstanceTupleNameToString<>);
                         PrintInstanceTupleNameToString<>);

// EncodeTest with EOS / No EOS and inputMaxBufRatio
// inputMaxBufRatio is ratio w.r.t. to mInputMaxBufSize
INSTANTIATE_TEST_SUITE_P(EncodeTest, Codec2AudioEncEncodeTest,
                         testing::ValuesIn(kEncodeTestParameters),
                         android::hardware::PrintInstanceTupleNameToString<>);
                         PrintInstanceTupleNameToString<>);

}  // anonymous namespace

@@ -768,13 +764,13 @@ int main(int argc, char** argv) {
    kTestParameters = getTestParameters(C2Component::DOMAIN_AUDIO, C2Component::KIND_ENCODER);
    for (auto params : kTestParameters) {
        kEncodeTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "false", "1"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), false, 1));
        kEncodeTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "false", "2"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), false, 2));
        kEncodeTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "true", "1"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), true, 1));
        kEncodeTestParameters.push_back(
                std::make_tuple(std::get<0>(params), std::get<1>(params), "true", "2"));
                std::make_tuple(std::get<0>(params), std::get<1>(params), true, 2));
    }

    ::testing::InitGoogleTest(&argc, argv);
+22 −24
Original line number Diff line number Diff line
@@ -134,8 +134,7 @@ void workDone(const std::shared_ptr<android::Codec2Client::Component>& component
        for (size_t i = 0; i < updates.size(); ++i) {
            C2Param* param = updates[i].get();
            if (param->index() == C2StreamInitDataInfo::output::PARAM_TYPE) {
                C2StreamInitDataInfo::output* csdBuffer =
                        (C2StreamInitDataInfo::output*)(param);
                C2StreamInitDataInfo::output* csdBuffer = (C2StreamInitDataInfo::output*)(param);
                size_t csdSize = csdBuffer->flexCount();
                if (csdSize > 0) csd = true;
            } else if ((param->index() == C2StreamSampleRateInfo::output::PARAM_TYPE) ||
@@ -160,8 +159,7 @@ void workDone(const std::shared_ptr<android::Codec2Client::Component>& component
            typedef std::unique_lock<std::mutex> ULock;
            ULock l(queueLock);
            workQueue.push_back(std::move(work));
            if (!flushedIndices.empty() &&
                (frameIndexIt != flushedIndices.end())) {
            if (!flushedIndices.empty() && (frameIndexIt != flushedIndices.end())) {
                flushedIndices.erase(frameIndexIt);
            }
            queueCondition.notify_all();
@@ -178,15 +176,15 @@ int64_t getNowUs() {
}

// Return all test parameters, a list of tuple of <instance, component>
const std::vector<std::tuple<std::string, std::string>>& getTestParameters() {
const std::vector<TestParameters>& getTestParameters() {
    return getTestParameters(C2Component::DOMAIN_OTHER, C2Component::KIND_OTHER);
}

// Return all test parameters, a list of tuple of <instance, component> with matching domain and
// kind.
const std::vector<std::tuple<std::string, std::string>>& getTestParameters(
        C2Component::domain_t domain, C2Component::kind_t kind) {
    static std::vector<std::tuple<std::string, std::string>> parameters;
const std::vector<TestParameters>& getTestParameters(C2Component::domain_t domain,
                                                     C2Component::kind_t kind) {
    static std::vector<TestParameters> parameters;

    auto instances = android::Codec2Client::GetServiceNames();
    for (std::string instance : instances) {
+17 −4
Original line number Diff line number Diff line
@@ -40,7 +40,8 @@ using ::android::hardware::Void;

using namespace ::std::chrono;

static std::vector<std::tuple<std::string, std::string>> kTestParameters;
using TestParameters = std::tuple<std::string, std::string>;
static std::vector<TestParameters> kTestParameters;

// Resource directory
extern std::string sResourceDir;
@@ -54,6 +55,18 @@ struct FrameInfo {
    int64_t timestamp;
};

template <typename... T>
static inline std::string PrintInstanceTupleNameToString(
        const testing::TestParamInfo<std::tuple<T...>>& info) {
    std::stringstream ss;
    std::apply([&ss](auto&&... elems) { ((ss << elems << '_'), ...); }, info.param);
    ss << info.index;
    std::string param_string = ss.str();
    auto isNotAlphaNum = [](char c) { return !std::isalnum(c); };
    std::replace_if(param_string.begin(), param_string.end(), isNotAlphaNum, '_');
    return param_string;
}

/*
 * Handle Callback functions onWorkDone(), onTripped(),
 * onError(), onDeath(), onFramesRendered()
@@ -114,12 +127,12 @@ struct CodecListener : public android::Codec2Client::Listener {
void parseArgs(int argc, char** argv);

// Return all test parameters, a list of tuple of <instance, component>.
const std::vector<std::tuple<std::string, std::string>>& getTestParameters();
const std::vector<TestParameters>& getTestParameters();

// Return all test parameters, a list of tuple of <instance, component> with matching domain and
// kind.
const std::vector<std::tuple<std::string, std::string>>& getTestParameters(
        C2Component::domain_t domain, C2Component::kind_t kind);
const std::vector<TestParameters>& getTestParameters(C2Component::domain_t domain,
                                                     C2Component::kind_t kind);

/*
 * common functions declarations
Loading