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

Commit 9fe004c2 authored by Ram Mohan M's avatar Ram Mohan M Committed by Pawin Vongmasa
Browse files

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
parent df5dd34d
Loading
Loading
Loading
Loading
+30 −3
Original line number Diff line number Diff line
@@ -371,7 +371,7 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
        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 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
            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);
            // 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 @@ TEST_F(ComponentHidlTest, DISABLED_PopulatePort) {
        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);