summaryrefslogtreecommitdiff
path: root/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp')
-rw-r--r--media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp b/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp
index ce9fc39e68..c7c04c588c 100644
--- a/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp
+++ b/media/codec2/hal/hidl/1.0/vts/functional/audio/VtsHalMediaC2V1_0TargetAudioDecTest.cpp
@@ -90,8 +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++, getBufferPoolVer());
+ mLinearPool = std::make_shared<C2PooledBlockPool>(mLinearAllocator, mBlockPoolId++,
+ getBufferPoolVer());
ASSERT_NE(mLinearPool, nullptr);
std::vector<std::unique_ptr<C2Param>> queried;
@@ -336,7 +336,9 @@ void decodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp
ASSERT_TRUE(false) << "Wait for generating C2Work exceeded timeout";
}
int64_t timestamp = (*Info)[frameID].timestamp;
- flags = ((*Info)[frameID].flags == FLAG_CONFIG_DATA) ? C2FrameData::FLAG_CODEC_CONFIG : 0;
+ flags = ((*Info)[frameID].vtsFlags & (1 << VTS_BIT_FLAG_CSD_FRAME))
+ ? C2FrameData::FLAG_CODEC_CONFIG
+ : 0;
if (signalEOS && ((frameID == (int)Info->size() - 1) || (frameID == (offset + range - 1))))
flags |= C2FrameData::FLAG_END_OF_STREAM;
@@ -531,14 +533,10 @@ TEST_P(Codec2AudioDecHidlTest, ThumbnailTest) {
// request EOS for thumbnail
// signal EOS flag with last frame
- size_t i = -1;
- uint32_t flags;
- do {
- i++;
- flags = 0;
- if (Info[i].flags) flags = 1u << (Info[i].flags - 1);
-
- } while (!(flags & SYNC_FRAME));
+ size_t i;
+ for (i = 0; i < Info.size(); i++) {
+ if (Info[i].vtsFlags & (1 << VTS_BIT_FLAG_SYNC_FRAME)) break;
+ }
std::ifstream eleStream;
eleStream.open(mInputFile, std::ifstream::binary);
ASSERT_EQ(eleStream.is_open(), true);
@@ -643,14 +641,11 @@ TEST_P(Codec2AudioDecHidlTest, FlushTest) {
mFlushedIndices.clear();
int index = numFramesFlushed;
bool keyFrame = false;
- uint32_t flags = 0;
while (index < (int)Info.size()) {
- if (Info[index].flags) flags = 1u << (Info[index].flags - 1);
- if ((flags & SYNC_FRAME) == SYNC_FRAME) {
+ if (Info[index].vtsFlags & (1 << VTS_BIT_FLAG_SYNC_FRAME)) {
keyFrame = true;
break;
}
- flags = 0;
eleStream.ignore(Info[index].bytesCount);
index++;
}
@@ -684,24 +679,24 @@ TEST_P(Codec2AudioDecHidlTest, DecodeTestEmptyBuffersInserted) {
int bytesCount = 0;
uint32_t frameId = 0;
uint32_t flags = 0;
+ uint32_t vtsFlags = 0;
uint32_t timestamp = 0;
bool codecConfig = false;
// This test introduces empty CSD after every 20th frame
// and empty input frames at an interval of 5 frames.
while (1) {
if (!(frameId % 5)) {
- if (!(frameId % 20))
- flags = 32;
- else
- flags = 0;
+ vtsFlags = !(frameId % 20) ? (1 << VTS_BIT_FLAG_CSD_FRAME) : 0;
bytesCount = 0;
} else {
if (!(eleInfo >> bytesCount)) break;
eleInfo >> flags;
+ vtsFlags = mapInfoFlagstoVtsFlags(flags);
+ ASSERT_NE(vtsFlags, 0xFF) << "unrecognized flag entry in info file: " << mInfoFile;
eleInfo >> timestamp;
- codecConfig = flags ? ((1 << (flags - 1)) & C2FrameData::FLAG_CODEC_CONFIG) != 0 : 0;
+ codecConfig = (vtsFlags & (1 << VTS_BIT_FLAG_CSD_FRAME)) != 0;
}
- Info.push_back({bytesCount, flags, timestamp});
+ Info.push_back({bytesCount, vtsFlags, timestamp});
frameId++;
}
eleInfo.close();