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

Commit 893d0831 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "VTS: Fix MultiChannelCount and MultiSampleRate Test in audio encoder"

parents 31eb2bfe 70210892
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -658,8 +658,11 @@ TEST_P(Codec2AudioEncHidlTest, MultiChannelCountTest) {
        }

        // To check if the input stream is sufficient to encode for the higher channel count
        struct stat buf;
        stat(mURL, &buf);
        size_t fileSize = buf.st_size;
        int32_t bytesCount = (samplesPerFrame * nChannels * 2) * numFrames;
        if (eleStream.gcount() < bytesCount) {
        if (fileSize < bytesCount) {
            std::cout << "[   WARN   ] Test Skipped for ChannelCount " << nChannels
                      << " because of insufficient input data\n";
            continue;
@@ -683,9 +686,6 @@ TEST_P(Codec2AudioEncHidlTest, MultiChannelCountTest) {
        // blocking call to ensures application to Wait till all the inputs are consumed
        waitOnInputConsumption(mQueueLock, mQueueCondition, mWorkQueue);

        // Validate output size based on chosen ChannelCount
        EXPECT_GE(mOutputSize, prevOutputSize);

        prevChannelCount = nChannels;
        prevOutputSize = mOutputSize;

@@ -700,7 +700,8 @@ TEST_P(Codec2AudioEncHidlTest, MultiChannelCountTest) {
            ASSERT_TRUE(mCsd) << "CSD buffer missing";
        }
        ASSERT_TRUE(mEos);
        ASSERT_EQ(mComponent->stop(), C2_OK);
        // TODO(b/147348711) Use reset instead of stop when using the same instance of codec.
        ASSERT_EQ(mComponent->reset(), C2_OK);
        mFramesReceived = 0;
        mOutputSize = 0;
        mEos = false;
@@ -760,8 +761,11 @@ TEST_P(Codec2AudioEncHidlTest, MultiSampleRateTest) {
        }

        // To check if the input stream is sufficient to encode for the higher SampleRate
        struct stat buf;
        stat(mURL, &buf);
        size_t fileSize = buf.st_size;
        int32_t bytesCount = (samplesPerFrame * nChannels * 2) * numFrames;
        if (eleStream.gcount() < bytesCount) {
        if (fileSize < bytesCount) {
            std::cout << "[   WARN   ] Test Skipped for SampleRate " << nSampleRate
                      << " because of insufficient input data\n";
            continue;
@@ -785,12 +789,6 @@ TEST_P(Codec2AudioEncHidlTest, MultiSampleRateTest) {
        // blocking call to ensures application to Wait till all the inputs are consumed
        waitOnInputConsumption(mQueueLock, mQueueCondition, mWorkQueue);

        // Validate output size based on chosen samplerate
        if (prevSampleRate >= nSampleRate) {
            EXPECT_LE(mOutputSize, prevOutputSize);
        } else {
            EXPECT_GT(mOutputSize, prevOutputSize);
        }
        prevSampleRate = nSampleRate;
        prevOutputSize = mOutputSize;

@@ -805,7 +803,8 @@ TEST_P(Codec2AudioEncHidlTest, MultiSampleRateTest) {
            ASSERT_TRUE(mCsd) << "CSD buffer missing";
        }
        ASSERT_TRUE(mEos);
        ASSERT_EQ(mComponent->stop(), C2_OK);
        // TODO(b/147348711) Use reset instead of stop when using the same instance of codec.
        ASSERT_EQ(mComponent->reset(), C2_OK);
        mFramesReceived = 0;
        mOutputSize = 0;
        mEos = false;