OSDN Git Service

bug fix: configure output port frame dimensions
authorRam Mohan M <ram.mohan@ittiam.com>
Thu, 15 Jun 2017 10:29:12 +0000 (15:59 +0530)
committerPawin Vongmasa <pawin@google.com>
Fri, 16 Jun 2017 23:26:41 +0000 (16:26 -0700)
frame dimensions are configured for input port but not output port.
As a result in qcom encoder components, the encoded image is getting
downsized to default dimensions configured for output port. This is now
corrected.

Test: make vts -j30 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: 62669756
Change-Id: Ib38006edbc82427d322632534ca78d78c5f30eff

media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp

index cd6eaf5..f6bc93a 100644 (file)
@@ -521,12 +521,15 @@ void getLatency(sp<IOmxNode> omxNode, OMX_U32 portIndex, uint32_t* latency) {
 // Set Default port param.
 void setDefaultPortParam(sp<IOmxNode> omxNode, OMX_U32 portIndex,
                          OMX_VIDEO_CODINGTYPE eCompressionFormat,
+                         OMX_U32 nFrameWidth, OMX_U32 nFrameHeight,
                          OMX_U32 nBitrate, OMX_U32 xFramerate) {
     android::hardware::media::omx::V1_0::Status status;
     OMX_PARAM_PORTDEFINITIONTYPE portDef;
     status = getPortParam(omxNode, OMX_IndexParamPortDefinition, portIndex,
                           &portDef);
     EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK);
+    portDef.format.video.nFrameWidth = nFrameWidth;
+    portDef.format.video.nFrameHeight = nFrameHeight;
     portDef.format.video.nBitrate = nBitrate;
     portDef.format.video.xFramerate = xFramerate;
     portDef.format.video.bFlagErrorConcealment = OMX_TRUE;
@@ -1028,6 +1031,9 @@ void encodeNFrames(sp<IOmxNode> omxNode, sp<CodecObserver> observer,
             } else if (msg.data.eventData.event == OMX_EventError) {
                 EXPECT_TRUE(false) << "Received OMX_EventError, not sure why";
                 break;
+            } else if (msg.data.eventData.event == OMX_EventDataSpaceChanged) {
+                // TODO: how am i supposed to respond now?
+                std::cout << "[          ] Info ! OMX_EventDataSpaceChanged \n";
             } else {
                 ASSERT_TRUE(false);
             }
@@ -1234,8 +1240,8 @@ TEST_F(VideoEncHidlTest, EncodeTest) {
 
     // Configure output port
     uint32_t nBitRate = 512000;
-    setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat, nBitRate,
-                        xFramerate);
+    setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
+                        nFrameWidth, nFrameHeight, nBitRate, xFramerate);
     setRefreshPeriod(omxNode, kPortIndexOutput, 0);
 
     unsigned int index;
@@ -1319,6 +1325,11 @@ TEST_F(VideoEncHidlTest, EncodeTestBufferMetaModes) {
     setupRAWPort(omxNode, kPortIndexInput, nFrameWidth, nFrameHeight, 0,
                  xFramerate, eColorFormat);
 
+    // Configure output port
+    uint32_t nBitRate = 512000;
+    setDefaultPortParam(omxNode, kPortIndexOutput, eCompressionFormat,
+                        nFrameWidth, nFrameHeight, nBitRate, xFramerate);
+
     // CreateInputSurface
     EXPECT_TRUE(omx->createInputSurface(
                        [&](android::hardware::media::omx::V1_0::Status _s,