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

Commit 34ad1d90 authored by Rakesh Kumar's avatar Rakesh Kumar Committed by Sungtak Lee
Browse files

codec2: VTS add support for Empty EOS in AudioEnctest

Test: VtsHidlC2V1_0TargetAudioEncTest -I software -P /sdcard/res/ -C c2.android.aac.encoder
Bug: 127691941
Change-Id: Ibd9696156c19e042584101285551742b7c91d4d0
parent f380958e
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -355,12 +355,17 @@ TEST_F(Codec2AudioEncHidlTest, validateCompName) {
    ASSERT_EQ(mDisableTest, false);
}

TEST_F(Codec2AudioEncHidlTest, EncodeTest) {
class Codec2AudioEncEncodeTest : public Codec2AudioEncHidlTest,
                                 public ::testing::WithParamInterface<bool> {
};

TEST_P(Codec2AudioEncEncodeTest, EncodeTest) {
    ALOGV("EncodeTest");
    if (mDisableTest) return;
    char mURL[512];
    strcpy(mURL, gEnv->getRes().c_str());
    GetURLForComponent(mCompName, mURL);
    bool signalEOS = GetParam();

    // Setting default configuration
    int32_t nChannels = 2;
@@ -408,7 +413,19 @@ TEST_F(Codec2AudioEncHidlTest, EncodeTest) {
    ASSERT_NO_FATAL_FAILURE(
        encodeNFrames(mComponent, mQueueLock, mQueueCondition, mWorkQueue,
                      mFlushedIndices, mLinearPool, eleStream, numFrames,
                      samplesPerFrame, nChannels, nSampleRate));
                      samplesPerFrame, nChannels, nSampleRate, false,
                      signalEOS));

    // If EOS is not sent, sending empty input with EOS flag
    if (!signalEOS) {
        ASSERT_NO_FATAL_FAILURE(
            waitOnInputConsumption(mQueueLock, mQueueCondition, mWorkQueue, 1));
        ASSERT_NO_FATAL_FAILURE(
            testInputBuffer(mComponent, mQueueLock, mWorkQueue,
                            C2FrameData::FLAG_END_OF_STREAM, false));
        numFrames += 1;
    }

    // blocking call to ensures application to Wait till all the inputs are
    // consumed
    ASSERT_NO_FATAL_FAILURE(
@@ -429,6 +446,10 @@ TEST_F(Codec2AudioEncHidlTest, EncodeTest) {
    ASSERT_EQ(mComponent->stop(), C2_OK);
}

// EncodeTest with EOS / No EOS
INSTANTIATE_TEST_CASE_P(EncodeTestwithEOS, Codec2AudioEncEncodeTest,
                        ::testing::Values(true, false));

TEST_F(Codec2AudioEncHidlTest, EOSTest) {
    description("Test empty input buffer with EOS flag");
    if (mDisableTest) return;