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

Commit 5fe60768 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Modify SetDefaultPortParams test" into oc-mr1-dev

parents f88227bd 9fe004c2
Loading
Loading
Loading
Loading
+30 −3
Original line number Original line Diff line number Diff line
@@ -371,7 +371,7 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
        kPortIndexOutput = kPortIndexInput + 1;
        kPortIndexOutput = kPortIndexInput + 1;
    }
    }


    for (size_t i = kPortIndexInput; i < kPortIndexOutput; i++) {
    for (size_t i = kPortIndexInput; i <= kPortIndexOutput; i++) {
        OMX_PARAM_PORTDEFINITIONTYPE portDef;
        OMX_PARAM_PORTDEFINITIONTYPE portDef;
        status =
        status =
            getPortParam(omxNode, OMX_IndexParamPortDefinition, i, &portDef);
            getPortParam(omxNode, OMX_IndexParamPortDefinition, i, &portDef);
@@ -406,10 +406,32 @@ TEST_F(ComponentHidlTest, DISABLED_SetDefaultPortParams) {
            setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
            setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);


            portDef = 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);
            setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &portDef);
            getPortParam(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);
                EXPECT_EQ(portDef.nBufferSize, mirror.nBufferSize);
            }
            setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);
            setPortParam(omxNode, OMX_IndexParamPortDefinition, i, &mirror);


            portDef = mirror;
            portDef = mirror;
@@ -467,6 +489,11 @@ TEST_F(ComponentHidlTest, DISABLED_PopulatePort) {
        portBase = params.nStartPortNumber;
        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;
    OMX_PARAM_PORTDEFINITIONTYPE portDef;
    status =
    status =
        getPortParam(omxNode, OMX_IndexParamPortDefinition, portBase, &portDef);
        getPortParam(omxNode, OMX_IndexParamPortDefinition, portBase, &portDef);