Change Encode output port Buffer size

o incoporate reviewer's comment to set parameter first to avoid code duplication

bug - 3115953

Change-Id: Iaadbc4b803e0b9baa929494f3f3882c1fae45dd2
Signed-off-by: SeungBeom Kim <sbcrux.kim@samsung.com>
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c
index c1bd4ef..eff5dec 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.c
@@ -1235,6 +1235,28 @@
         ret = OMX_ErrorNone;
     }
         break;
+    case OMX_IndexParamPortDefinition:
+    {
+        OMX_PARAM_PORTDEFINITIONTYPE *pPortDefinition =
+                (OMX_PARAM_PORTDEFINITIONTYPE *)ComponentParameterStructure;
+        ret = SEC_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure);
+        if (ret != OMX_ErrorNone) {
+            goto EXIT;
+        }
+
+        if (pPortDefinition->nPortIndex == INPUT_PORT_INDEX) {
+            SEC_OMX_BASEPORT *pSECInputPort = &pSECComponent->pSECPort[INPUT_PORT_INDEX];
+            OMX_U32 width = pSECInputPort->portDefinition.format.video.nFrameWidth;
+            OMX_U32 height = pSECInputPort->portDefinition.format.video.nFrameHeight;
+            SEC_OMX_BASEPORT *pSECOutputPort = &pSECComponent->pSECPort[OUTPUT_PORT_INDEX];
+            pSECOutputPort->portDefinition.format.video.nFrameWidth = width;
+            pSECOutputPort->portDefinition.format.video.nFrameHeight = height;
+            pSECOutputPort->portDefinition.nBufferSize = (width * height * 3) / 2;
+            SEC_OSAL_Log(SEC_LOG_TRACE, "pSECOutputPort->portDefinition.nBufferSize: %d",
+                            pSECOutputPort->portDefinition.nBufferSize);
+        }
+    }
+        break;
     default:
     {
         ret = SEC_OMX_SetParameter(hComponent, nIndex, ComponentParameterStructure);
diff --git a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h
index 4654a24..93d2800 100644
--- a/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h
+++ b/sec_mm/sec_omx/sec_omx_component/video/enc/SEC_OMX_Venc.h
@@ -42,7 +42,7 @@
 #define DEFAULT_VIDEO_INPUT_BUFFER_SIZE    ALIGN_TO_8KB(ALIGN_TO_128B(DEFAULT_FRAME_WIDTH) * ALIGN_TO_32B(DEFAULT_FRAME_HEIGHT)) \
                                            + ALIGN_TO_8KB(ALIGN_TO_128B(DEFAULT_FRAME_WIDTH) * ALIGN_TO_32B(DEFAULT_FRAME_HEIGHT / 2))
                                            /* (DEFAULT_FRAME_WIDTH * DEFAULT_FRAME_HEIGHT * 3) / 2 */
-#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE   1024 * 1024
+#define DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE   DEFAULT_VIDEO_INPUT_BUFFER_SIZE
 
 #define INPUT_PORT_SUPPORTFORMAT_NUM_MAX    3
 #define OUTPUT_PORT_SUPPORTFORMAT_NUM_MAX   1