Loading media/codec2/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioEncTest.cpp +138 −72 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ class LinearBuffer : public C2Buffer { : C2Buffer({block->share(block->offset(), block->size(), ::C2Fence())}) {} }; constexpr uint32_t kMaxSamplesPerFrame = 256; namespace { class Codec2AudioEncHidlTestBase : public ::testing::Test { Loading Loading @@ -98,7 +100,7 @@ class Codec2AudioEncHidlTestBase : public ::testing::Test { // Get the test parameters from GetParam call. virtual void getParams() {} void GetURLForComponent(char* mURL); void GetURLForComponent(char* mURL, int32_t channelCount, int32_t sampleRate); // callback function to process onWorkDone received by Listener void handleWorkDone(std::list<std::unique_ptr<C2Work>>& workItems) { Loading Loading @@ -223,53 +225,105 @@ bool setupConfigParam(const std::shared_ptr<android::Codec2Client::Component>& c return false; } // Get config params for a component bool getConfigParams(std::string mime, int32_t* nChannels, int32_t* nSampleRate, int32_t* samplesPerFrame) { if (mime.find("mp4a-latm") != std::string::npos) { *nChannels = 2; *nSampleRate = 48000; *samplesPerFrame = 1024; } else if (mime.find("flac") != std::string::npos) { *nChannels = 2; *nSampleRate = 48000; *samplesPerFrame = 1152; } else if (mime.find("opus") != std::string::npos) { c2_status_t getChannelCount(const std::shared_ptr<android::Codec2Client::Component>& component, int32_t* nChannels) { std::unique_ptr<C2StreamChannelCountInfo::input> channelCount = std::make_unique<C2StreamChannelCountInfo::input>(); std::vector<C2FieldSupportedValuesQuery> validValueInfos = { C2FieldSupportedValuesQuery::Current( C2ParamField(channelCount.get(), &C2StreamChannelCountInfo::value))}; c2_status_t c2err = component->querySupportedValues(validValueInfos, C2_DONT_BLOCK); if (c2err != C2_OK || validValueInfos.size() != 1u) { ALOGE("querySupportedValues_vb failed for channelCount"); return c2err; } // setting default value of channelCount *nChannels = 1; const auto& c2FSV = validValueInfos[0].values; switch (c2FSV.type) { case C2FieldSupportedValues::type_t::RANGE: { const auto& range = c2FSV.range; uint32_t rmax = (uint32_t)(range.max).ref<uint32_t>(); if (rmax >= 2) { *nChannels = 2; *nSampleRate = 48000; *samplesPerFrame = 960; } else if (mime.find("3gpp") != std::string::npos) { } else { *nChannels = 1; *nSampleRate = 8000; *samplesPerFrame = 160; } else if (mime.find("amr-wb") != std::string::npos) { } break; } case C2FieldSupportedValues::type_t::VALUES: { for (const C2Value::Primitive& prim : c2FSV.values) { if ((uint32_t)prim.ref<uint32_t>() == 2) { *nChannels = 2; } else if ((uint32_t)prim.ref<uint32_t>() == 1) { *nChannels = 1; *nSampleRate = 16000; *samplesPerFrame = 160; } else return false; } } break; } default: break; } return C2_OK; } return true; c2_status_t getSampleRate(const std::shared_ptr<android::Codec2Client::Component>& component, int32_t* nSampleRate) { // Use the default sample rate for components std::vector<std::unique_ptr<C2Param>> queried; c2_status_t c2err = component->query({}, {C2StreamSampleRateInfo::input::PARAM_TYPE}, C2_DONT_BLOCK, &queried); if (c2err != C2_OK || queried.size() == 0) return c2err; size_t offset = sizeof(C2Param); C2Param* param = queried[0].get(); *nSampleRate = *(int32_t*)((uint8_t*)param + offset); return C2_OK; } // LookUpTable of clips and metadata for component testing void Codec2AudioEncHidlTestBase::GetURLForComponent(char* mURL) { struct CompToURL { std::string mime; 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"}, {"opus", "bbb_raw_2ch_48khz_s16le.raw"}, }; c2_status_t getSamplesPerFrame(const std::shared_ptr<android::Codec2Client::Component>& component, int32_t nChannels, int32_t* samplesPerFrame) { std::vector<std::unique_ptr<C2Param>> queried; c2_status_t c2err = component->query({}, {C2StreamMaxBufferSizeInfo::input::PARAM_TYPE}, C2_DONT_BLOCK, &queried); if (c2err != C2_OK || queried.size() == 0) return c2err; for (size_t i = 0; i < sizeof(kCompToURL) / sizeof(kCompToURL[0]); ++i) { if (mMime.find(kCompToURL[i].mime) != std::string::npos) { strcat(mURL, kCompToURL[i].mURL); return; size_t offset = sizeof(C2Param); C2Param* param = queried[0].get(); uint32_t maxInputSize = *(uint32_t*)((uint8_t*)param + offset); *samplesPerFrame = std::min((maxInputSize / (nChannels * 2)), kMaxSamplesPerFrame); return C2_OK; } // Get config params for a component bool getConfigParams(const std::shared_ptr<android::Codec2Client::Component>& component, int32_t* nChannels, int32_t* nSampleRate, int32_t* samplesPerFrame) { c2_status_t status = getChannelCount(component, nChannels); if (status != C2_OK) return false; status = getSampleRate(component, nSampleRate); if (status != C2_OK) return false; status = getSamplesPerFrame(component, *nChannels, samplesPerFrame); if (status != C2_OK) return false; return true; } // LookUpTable of clips and metadata for component testing void Codec2AudioEncHidlTestBase::GetURLForComponent(char* mURL, int32_t channelCount, int32_t sampleRate) { std::string rawInput = "bbb_raw_1ch_8khz_s16le.raw"; if (channelCount == 1 && sampleRate == 16000) { rawInput = "bbb_raw_1ch_16khz_s16le.raw"; } else if (channelCount == 2) { rawInput = "bbb_raw_2ch_48khz_s16le.raw"; } strcat(mURL, rawInput.c_str()); } void encodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& component, Loading @@ -283,9 +337,17 @@ void encodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp uint32_t frameID = 0; uint32_t maxRetry = 0; int bytesCount = samplesPerFrame * nChannels * 2; uint32_t bytesCount = samplesPerFrame * nChannels * 2; int32_t timestampIncr = (int)(((float)samplesPerFrame / nSampleRate) * 1000000); uint64_t timestamp = 0; // get length of file: int32_t currPos = eleStream.tellg(); eleStream.seekg(0, eleStream.end); uint32_t remainingBytes = (uint32_t)eleStream.tellg() - currPos; eleStream.seekg(currPos, eleStream.beg); nFrames = std::min(nFrames, remainingBytes / bytesCount); while (1) { if (nFrames == 0) break; uint32_t flags = 0; Loading Loading @@ -319,7 +381,12 @@ void encodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp char* data = (char*)malloc(bytesCount); ASSERT_NE(data, nullptr); eleStream.read(data, bytesCount); ASSERT_EQ(eleStream.gcount(), bytesCount); // if we have reached at the end of input stream, signal eos if (eleStream.gcount() < bytesCount) { bytesCount = eleStream.gcount(); if (signalEOS) flags |= C2FrameData::FLAG_END_OF_STREAM; } std::shared_ptr<C2LinearBlock> block; ASSERT_EQ(C2_OK, linearPool->fetchLinearBlock( Loading Loading @@ -373,9 +440,6 @@ class Codec2AudioEncEncodeTest : public Codec2AudioEncHidlTestBase, TEST_P(Codec2AudioEncEncodeTest, EncodeTest) { ALOGV("EncodeTest"); if (mDisableTest) GTEST_SKIP() << "Test is disabled"; char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL); bool signalEOS = std::get<2>(GetParam()); // Ratio w.r.t to mInputMaxBufSize int32_t inputMaxBufRatio = std::get<3>(GetParam()); Loading @@ -384,7 +448,7 @@ TEST_P(Codec2AudioEncEncodeTest, EncodeTest) { int32_t nSampleRate; int32_t samplesPerFrame; if (!getConfigParams(mMime, &nChannels, &nSampleRate, &samplesPerFrame)) { if (!getConfigParams(mComponent, &nChannels, &nSampleRate, &samplesPerFrame)) { std::cout << "Failed to get the config params for " << mComponentName << "\n"; std::cout << "[ WARN ] Test Skipped \n"; return; Loading @@ -398,6 +462,10 @@ TEST_P(Codec2AudioEncEncodeTest, EncodeTest) { std::cout << "[ WARN ] Test Skipped \n"; return; } char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL, nChannels, nSampleRate); ASSERT_EQ(mComponent->start(), C2_OK); std::ifstream eleStream; uint32_t numFrames = 16; Loading Loading @@ -479,16 +547,12 @@ TEST_P(Codec2AudioEncHidlTest, FlushTest) { description("Test Request for flush"); if (mDisableTest) GTEST_SKIP() << "Test is disabled"; char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL); mFlushedIndices.clear(); int32_t nChannels; int32_t nSampleRate; int32_t samplesPerFrame; if (!getConfigParams(mMime, &nChannels, &nSampleRate, &samplesPerFrame)) { if (!getConfigParams(mComponent, &nChannels, &nSampleRate, &samplesPerFrame)) { std::cout << "Failed to get the config params for " << mComponentName << "\n"; std::cout << "[ WARN ] Test Skipped \n"; return; Loading @@ -498,6 +562,10 @@ TEST_P(Codec2AudioEncHidlTest, FlushTest) { std::cout << "[ WARN ] Test Skipped \n"; return; } char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL, nChannels, nSampleRate); ASSERT_EQ(mComponent->start(), C2_OK); std::ifstream eleStream; Loading Loading @@ -544,26 +612,25 @@ TEST_P(Codec2AudioEncHidlTest, MultiChannelCountTest) { description("Encodes input file for different channel count"); if (mDisableTest) GTEST_SKIP() << "Test is disabled"; char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL); std::ifstream eleStream; eleStream.open(mURL, std::ifstream::binary); ASSERT_EQ(eleStream.is_open(), true) << mURL << " file not found"; ALOGV("mURL : %s", mURL); int32_t nSampleRate; int32_t samplesPerFrame; int32_t nChannels; int32_t numFrames = 16; int32_t maxChannelCount = 8; if (!getConfigParams(mMime, &nChannels, &nSampleRate, &samplesPerFrame)) { if (!getConfigParams(mComponent, &nChannels, &nSampleRate, &samplesPerFrame)) { std::cout << "Failed to get the config params for " << mComponentName << "\n"; std::cout << "[ WARN ] Test Skipped \n"; return; } char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL, nChannels, nSampleRate); std::ifstream eleStream; eleStream.open(mURL, std::ifstream::binary); ASSERT_EQ(eleStream.is_open(), true) << mURL << " file not found"; ALOGV("mURL : %s", mURL); uint64_t prevOutputSize = 0u; uint32_t prevChannelCount = 0u; Loading Loading @@ -646,25 +713,24 @@ TEST_P(Codec2AudioEncHidlTest, MultiSampleRateTest) { description("Encodes input file for different SampleRate"); if (mDisableTest) GTEST_SKIP() << "Test is disabled"; char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL); std::ifstream eleStream; eleStream.open(mURL, std::ifstream::binary); ASSERT_EQ(eleStream.is_open(), true) << mURL << " file not found"; ALOGV("mURL : %s", mURL); int32_t nSampleRate; int32_t samplesPerFrame; int32_t nChannels; int32_t numFrames = 16; if (!getConfigParams(mMime, &nChannels, &nSampleRate, &samplesPerFrame)) { if (!getConfigParams(mComponent, &nChannels, &nSampleRate, &samplesPerFrame)) { std::cout << "Failed to get the config params for " << mComponentName << "\n"; std::cout << "[ WARN ] Test Skipped \n"; return; } char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL, nChannels, nSampleRate); std::ifstream eleStream; eleStream.open(mURL, std::ifstream::binary); ASSERT_EQ(eleStream.is_open(), true) << mURL << " file not found"; ALOGV("mURL : %s", mURL); int32_t sampleRateValues[] = {1000, 8000, 16000, 24000, 48000, 96000, 192000}; Loading Loading
media/codec2/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioEncTest.cpp +138 −72 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ class LinearBuffer : public C2Buffer { : C2Buffer({block->share(block->offset(), block->size(), ::C2Fence())}) {} }; constexpr uint32_t kMaxSamplesPerFrame = 256; namespace { class Codec2AudioEncHidlTestBase : public ::testing::Test { Loading Loading @@ -98,7 +100,7 @@ class Codec2AudioEncHidlTestBase : public ::testing::Test { // Get the test parameters from GetParam call. virtual void getParams() {} void GetURLForComponent(char* mURL); void GetURLForComponent(char* mURL, int32_t channelCount, int32_t sampleRate); // callback function to process onWorkDone received by Listener void handleWorkDone(std::list<std::unique_ptr<C2Work>>& workItems) { Loading Loading @@ -223,53 +225,105 @@ bool setupConfigParam(const std::shared_ptr<android::Codec2Client::Component>& c return false; } // Get config params for a component bool getConfigParams(std::string mime, int32_t* nChannels, int32_t* nSampleRate, int32_t* samplesPerFrame) { if (mime.find("mp4a-latm") != std::string::npos) { *nChannels = 2; *nSampleRate = 48000; *samplesPerFrame = 1024; } else if (mime.find("flac") != std::string::npos) { *nChannels = 2; *nSampleRate = 48000; *samplesPerFrame = 1152; } else if (mime.find("opus") != std::string::npos) { c2_status_t getChannelCount(const std::shared_ptr<android::Codec2Client::Component>& component, int32_t* nChannels) { std::unique_ptr<C2StreamChannelCountInfo::input> channelCount = std::make_unique<C2StreamChannelCountInfo::input>(); std::vector<C2FieldSupportedValuesQuery> validValueInfos = { C2FieldSupportedValuesQuery::Current( C2ParamField(channelCount.get(), &C2StreamChannelCountInfo::value))}; c2_status_t c2err = component->querySupportedValues(validValueInfos, C2_DONT_BLOCK); if (c2err != C2_OK || validValueInfos.size() != 1u) { ALOGE("querySupportedValues_vb failed for channelCount"); return c2err; } // setting default value of channelCount *nChannels = 1; const auto& c2FSV = validValueInfos[0].values; switch (c2FSV.type) { case C2FieldSupportedValues::type_t::RANGE: { const auto& range = c2FSV.range; uint32_t rmax = (uint32_t)(range.max).ref<uint32_t>(); if (rmax >= 2) { *nChannels = 2; *nSampleRate = 48000; *samplesPerFrame = 960; } else if (mime.find("3gpp") != std::string::npos) { } else { *nChannels = 1; *nSampleRate = 8000; *samplesPerFrame = 160; } else if (mime.find("amr-wb") != std::string::npos) { } break; } case C2FieldSupportedValues::type_t::VALUES: { for (const C2Value::Primitive& prim : c2FSV.values) { if ((uint32_t)prim.ref<uint32_t>() == 2) { *nChannels = 2; } else if ((uint32_t)prim.ref<uint32_t>() == 1) { *nChannels = 1; *nSampleRate = 16000; *samplesPerFrame = 160; } else return false; } } break; } default: break; } return C2_OK; } return true; c2_status_t getSampleRate(const std::shared_ptr<android::Codec2Client::Component>& component, int32_t* nSampleRate) { // Use the default sample rate for components std::vector<std::unique_ptr<C2Param>> queried; c2_status_t c2err = component->query({}, {C2StreamSampleRateInfo::input::PARAM_TYPE}, C2_DONT_BLOCK, &queried); if (c2err != C2_OK || queried.size() == 0) return c2err; size_t offset = sizeof(C2Param); C2Param* param = queried[0].get(); *nSampleRate = *(int32_t*)((uint8_t*)param + offset); return C2_OK; } // LookUpTable of clips and metadata for component testing void Codec2AudioEncHidlTestBase::GetURLForComponent(char* mURL) { struct CompToURL { std::string mime; 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"}, {"opus", "bbb_raw_2ch_48khz_s16le.raw"}, }; c2_status_t getSamplesPerFrame(const std::shared_ptr<android::Codec2Client::Component>& component, int32_t nChannels, int32_t* samplesPerFrame) { std::vector<std::unique_ptr<C2Param>> queried; c2_status_t c2err = component->query({}, {C2StreamMaxBufferSizeInfo::input::PARAM_TYPE}, C2_DONT_BLOCK, &queried); if (c2err != C2_OK || queried.size() == 0) return c2err; for (size_t i = 0; i < sizeof(kCompToURL) / sizeof(kCompToURL[0]); ++i) { if (mMime.find(kCompToURL[i].mime) != std::string::npos) { strcat(mURL, kCompToURL[i].mURL); return; size_t offset = sizeof(C2Param); C2Param* param = queried[0].get(); uint32_t maxInputSize = *(uint32_t*)((uint8_t*)param + offset); *samplesPerFrame = std::min((maxInputSize / (nChannels * 2)), kMaxSamplesPerFrame); return C2_OK; } // Get config params for a component bool getConfigParams(const std::shared_ptr<android::Codec2Client::Component>& component, int32_t* nChannels, int32_t* nSampleRate, int32_t* samplesPerFrame) { c2_status_t status = getChannelCount(component, nChannels); if (status != C2_OK) return false; status = getSampleRate(component, nSampleRate); if (status != C2_OK) return false; status = getSamplesPerFrame(component, *nChannels, samplesPerFrame); if (status != C2_OK) return false; return true; } // LookUpTable of clips and metadata for component testing void Codec2AudioEncHidlTestBase::GetURLForComponent(char* mURL, int32_t channelCount, int32_t sampleRate) { std::string rawInput = "bbb_raw_1ch_8khz_s16le.raw"; if (channelCount == 1 && sampleRate == 16000) { rawInput = "bbb_raw_1ch_16khz_s16le.raw"; } else if (channelCount == 2) { rawInput = "bbb_raw_2ch_48khz_s16le.raw"; } strcat(mURL, rawInput.c_str()); } void encodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& component, Loading @@ -283,9 +337,17 @@ void encodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp uint32_t frameID = 0; uint32_t maxRetry = 0; int bytesCount = samplesPerFrame * nChannels * 2; uint32_t bytesCount = samplesPerFrame * nChannels * 2; int32_t timestampIncr = (int)(((float)samplesPerFrame / nSampleRate) * 1000000); uint64_t timestamp = 0; // get length of file: int32_t currPos = eleStream.tellg(); eleStream.seekg(0, eleStream.end); uint32_t remainingBytes = (uint32_t)eleStream.tellg() - currPos; eleStream.seekg(currPos, eleStream.beg); nFrames = std::min(nFrames, remainingBytes / bytesCount); while (1) { if (nFrames == 0) break; uint32_t flags = 0; Loading Loading @@ -319,7 +381,12 @@ void encodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp char* data = (char*)malloc(bytesCount); ASSERT_NE(data, nullptr); eleStream.read(data, bytesCount); ASSERT_EQ(eleStream.gcount(), bytesCount); // if we have reached at the end of input stream, signal eos if (eleStream.gcount() < bytesCount) { bytesCount = eleStream.gcount(); if (signalEOS) flags |= C2FrameData::FLAG_END_OF_STREAM; } std::shared_ptr<C2LinearBlock> block; ASSERT_EQ(C2_OK, linearPool->fetchLinearBlock( Loading Loading @@ -373,9 +440,6 @@ class Codec2AudioEncEncodeTest : public Codec2AudioEncHidlTestBase, TEST_P(Codec2AudioEncEncodeTest, EncodeTest) { ALOGV("EncodeTest"); if (mDisableTest) GTEST_SKIP() << "Test is disabled"; char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL); bool signalEOS = std::get<2>(GetParam()); // Ratio w.r.t to mInputMaxBufSize int32_t inputMaxBufRatio = std::get<3>(GetParam()); Loading @@ -384,7 +448,7 @@ TEST_P(Codec2AudioEncEncodeTest, EncodeTest) { int32_t nSampleRate; int32_t samplesPerFrame; if (!getConfigParams(mMime, &nChannels, &nSampleRate, &samplesPerFrame)) { if (!getConfigParams(mComponent, &nChannels, &nSampleRate, &samplesPerFrame)) { std::cout << "Failed to get the config params for " << mComponentName << "\n"; std::cout << "[ WARN ] Test Skipped \n"; return; Loading @@ -398,6 +462,10 @@ TEST_P(Codec2AudioEncEncodeTest, EncodeTest) { std::cout << "[ WARN ] Test Skipped \n"; return; } char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL, nChannels, nSampleRate); ASSERT_EQ(mComponent->start(), C2_OK); std::ifstream eleStream; uint32_t numFrames = 16; Loading Loading @@ -479,16 +547,12 @@ TEST_P(Codec2AudioEncHidlTest, FlushTest) { description("Test Request for flush"); if (mDisableTest) GTEST_SKIP() << "Test is disabled"; char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL); mFlushedIndices.clear(); int32_t nChannels; int32_t nSampleRate; int32_t samplesPerFrame; if (!getConfigParams(mMime, &nChannels, &nSampleRate, &samplesPerFrame)) { if (!getConfigParams(mComponent, &nChannels, &nSampleRate, &samplesPerFrame)) { std::cout << "Failed to get the config params for " << mComponentName << "\n"; std::cout << "[ WARN ] Test Skipped \n"; return; Loading @@ -498,6 +562,10 @@ TEST_P(Codec2AudioEncHidlTest, FlushTest) { std::cout << "[ WARN ] Test Skipped \n"; return; } char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL, nChannels, nSampleRate); ASSERT_EQ(mComponent->start(), C2_OK); std::ifstream eleStream; Loading Loading @@ -544,26 +612,25 @@ TEST_P(Codec2AudioEncHidlTest, MultiChannelCountTest) { description("Encodes input file for different channel count"); if (mDisableTest) GTEST_SKIP() << "Test is disabled"; char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL); std::ifstream eleStream; eleStream.open(mURL, std::ifstream::binary); ASSERT_EQ(eleStream.is_open(), true) << mURL << " file not found"; ALOGV("mURL : %s", mURL); int32_t nSampleRate; int32_t samplesPerFrame; int32_t nChannels; int32_t numFrames = 16; int32_t maxChannelCount = 8; if (!getConfigParams(mMime, &nChannels, &nSampleRate, &samplesPerFrame)) { if (!getConfigParams(mComponent, &nChannels, &nSampleRate, &samplesPerFrame)) { std::cout << "Failed to get the config params for " << mComponentName << "\n"; std::cout << "[ WARN ] Test Skipped \n"; return; } char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL, nChannels, nSampleRate); std::ifstream eleStream; eleStream.open(mURL, std::ifstream::binary); ASSERT_EQ(eleStream.is_open(), true) << mURL << " file not found"; ALOGV("mURL : %s", mURL); uint64_t prevOutputSize = 0u; uint32_t prevChannelCount = 0u; Loading Loading @@ -646,25 +713,24 @@ TEST_P(Codec2AudioEncHidlTest, MultiSampleRateTest) { description("Encodes input file for different SampleRate"); if (mDisableTest) GTEST_SKIP() << "Test is disabled"; char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL); std::ifstream eleStream; eleStream.open(mURL, std::ifstream::binary); ASSERT_EQ(eleStream.is_open(), true) << mURL << " file not found"; ALOGV("mURL : %s", mURL); int32_t nSampleRate; int32_t samplesPerFrame; int32_t nChannels; int32_t numFrames = 16; if (!getConfigParams(mMime, &nChannels, &nSampleRate, &samplesPerFrame)) { if (!getConfigParams(mComponent, &nChannels, &nSampleRate, &samplesPerFrame)) { std::cout << "Failed to get the config params for " << mComponentName << "\n"; std::cout << "[ WARN ] Test Skipped \n"; return; } char mURL[512]; strcpy(mURL, sResourceDir.c_str()); GetURLForComponent(mURL, nChannels, nSampleRate); std::ifstream eleStream; eleStream.open(mURL, std::ifstream::binary); ASSERT_EQ(eleStream.is_open(), true) << mURL << " file not found"; ALOGV("mURL : %s", mURL); int32_t sampleRateValues[] = {1000, 8000, 16000, 24000, 48000, 96000, 192000}; Loading