Modify SetDefaultPortParams test
1. For output port in video encoder and input port in video decoder,
it is allowed to configure the size of the buffer. Make adjustments
in the test application to validate this scenario.
2. useBuffer api call is allowed only after sending loaded to idle
state transition command. Ensure this requirement is met.
Test: make vts -j99 BUILD_GOOGLE_VTS=true TARGET_PRODUCT=aosp_arm64 \
&& vts-tradefed run commandAndExit vts \
--skip-all-system-status-check --primary-abi-only \
--skip-preconditions --module VtsHalMediaOmxV1_0Test -l INFO
Bug: 63796949
Change-Id: I1aba7703e1344b87f556d3388a4cde8199898499
diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
index 0f29d91..235cfef 100644
--- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
+++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp
@@ -371,7 +371,7 @@
kPortIndexOutput = kPortIndexInput + 1;
}
- for (size_t i = kPortIndexInput; i < kPortIndexOutput; i++) {
+ for (size_t i = kPortIndexInput; i <= kPortIndexOutput; i++) {
OMX_PARAM_PORTDEFINITIONTYPE portDef;
status =
getPortParam(omxNode, OMX_IndexParamPortDefinition, i, &portDef);
@@ -406,10 +406,32 @@
setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
portDef = mirror;
- portDef.nBufferSize >>= 1;
+ OMX_U32 nBufferSize = portDef.nBufferSize >> 1;
+ if (nBufferSize != 0) {
+ if (!strncmp(gEnv->getComponent().c_str(), "OMX.google.", 11)) {
+ portDef.nBufferSize = nBufferSize;
+ } else {
+ // Probable alignment requirements of vendor component
+ portDef.nBufferSize = ALIGN_POWER_OF_TWO(nBufferSize, 12);
+ nBufferSize = portDef.nBufferSize;
+ }
+ } else {
+ ASSERT_TRUE(false) << "Unexpected buffer size";
+ }
setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &portDef);
getPortParam(omxNode, OMX_IndexParamPortDefinition, i, &portDef);
- EXPECT_EQ(portDef.nBufferSize, mirror.nBufferSize);
+ // SPECIAL CASE: For video decoder, allow configuration of input
+ // buffer size even if it is less than minimum requirement and
+ // similarly for encoder allow configuration of output port buffer
+ // size.
+ if ((compClass == video_encoder && i == kPortIndexOutput) ||
+ (compClass == video_decoder && i == kPortIndexInput)) {
+ double dev = (portDef.nBufferSize / (double)nBufferSize);
+ dev -= 1;
+ if (dev < 0 || dev > 0.1) EXPECT_TRUE(false);
+ } else {
+ EXPECT_EQ(portDef.nBufferSize, mirror.nBufferSize);
+ }
setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
portDef = mirror;
@@ -467,6 +489,11 @@
portBase = params.nStartPortNumber;
}
+ // set state to idle
+ status = omxNode->sendCommand(toRawCommandType(OMX_CommandStateSet),
+ OMX_StateIdle);
+ ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK);
+
OMX_PARAM_PORTDEFINITIONTYPE portDef;
status =
getPortParam(omxNode, OMX_IndexParamPortDefinition, portBase, &portDef);