Browse Source

Merge branch 'CR_2515_OMX_VPU_515_Som.Qin' into 'jh7110-devel'

CR 2515 OMX:VPU: Fix FlushTest/PortCommunicationTest fail in omx-cts test

See merge request sdk/freelight-u-sdk!225
andy.hu 1 year ago
parent
commit
d4b242474f

+ 1 - 1
omx-il/component/video/wave4/SF_OMX_Wave420L_encoder.c

@@ -2354,7 +2354,7 @@ static OMX_ERRORTYPE SF_OMX_ComponentConstructor(SF_OMX_COMPONENT *pSfOMXCompone
 
     FunctionIn();
 
-    if (nInstance >= MAX_NUM_INSTANCE)
+    if (nInstance >= 1)
     {
         ret = OMX_ErrorInsufficientResources;
         goto EXIT;

+ 13 - 2
omx-il/component/video/wave5/common/SF_OMX_video_common.c

@@ -412,7 +412,7 @@ OMX_ERRORTYPE FlushBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U32 nPort)
         {
             OMX_U32 inputQueueCount = pSfVideoImplement->functions->Queue_Get_Cnt(pFeederComponent->srcPort.inputQ);
             LOG(SF_LOG_PERF, "Flush %d buffers on inputPort\r\n", inputQueueCount);
-            if (inputQueueCount > 0)
+            if (inputQueueCount > 0 && pSfOMXComponent->memory_optimization)
             {
                 PortContainerExternal *input = NULL;
                 while ((input = (PortContainerExternal*)pSfVideoImplement->functions->ComponentPortGetData(&pFeederComponent->srcPort)) != NULL)
@@ -427,6 +427,11 @@ OMX_ERRORTYPE FlushBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U32 nPort)
                     }
                 }
             }
+            else
+            {
+                LOG(SF_LOG_PERF, "clear internel Q\r\n");
+                pSfVideoImplement->functions->Queue_Flush(pFeederComponent->srcPort.inputQ);
+            }
         }
     }
     else if (nPort == 1)
@@ -436,7 +441,7 @@ OMX_ERRORTYPE FlushBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U32 nPort)
         {
             OMX_U32 OutputQueueCount = pSfVideoImplement->functions->Queue_Get_Cnt(pRendererComponent->sinkPort.inputQ);
             LOG(SF_LOG_PERF, "Flush %d buffers on outputPort\r\n", OutputQueueCount);
-            if (OutputQueueCount > 0)
+            if (OutputQueueCount > 0 && pSfOMXComponent->memory_optimization)
             {
                 PortContainerExternal *output = NULL;
                 while ((output = (PortContainerExternal*)pSfVideoImplement->functions->ComponentPortGetData(&pRendererComponent->sinkPort)) != NULL)
@@ -453,6 +458,11 @@ OMX_ERRORTYPE FlushBuffer(SF_OMX_COMPONENT *pSfOMXComponent, OMX_U32 nPort)
                     }
                 }
             }
+            else
+            {
+                LOG(SF_LOG_PERF, "clear internel Q\r\n");
+                pSfVideoImplement->functions->Queue_Flush(pRendererComponent->sinkPort.inputQ);
+            }
         }
     }
     FunctionOut();
@@ -510,6 +520,7 @@ static void sf_get_component_functions(SF_COMPONENT_FUNCTIONS *funcs, OMX_PTR *s
     // VPU
     funcs->VPU_GetProductId = dlsym(sohandle, "VPU_GetProductId");
     funcs->Queue_Enqueue = dlsym(sohandle, "Queue_Enqueue");
+    funcs->Queue_Flush = dlsym(sohandle, "Queue_Flush");
     funcs->Queue_Get_Cnt = dlsym(sohandle, "Queue_Get_Cnt");
     funcs->VPU_DecClrDispFlag = dlsym(sohandle, "VPU_DecClrDispFlag");
     funcs->VPU_DecGetFrameBuffer = dlsym(sohandle, "VPU_DecGetFrameBuffer");

+ 1 - 0
omx-il/component/video/wave5/common/SF_OMX_video_common.h

@@ -85,6 +85,7 @@ typedef struct _SF_COMPONENT_FUNCTIONS
     // VPU
     int (*VPU_GetProductId)(int coreIdx);
     BOOL(*Queue_Enqueue)(Queue *queue, void *data);
+    void (*Queue_Flush)(Queue* queue);
     Uint32 (*Queue_Get_Cnt)(Queue *queue);
     RetCode (*VPU_DecClrDispFlag)(DecHandle handle, int index);
     RetCode (*VPU_DecGetFrameBuffer)(DecHandle handle, int frameIdx, FrameBuffer* frameBuf);

+ 8 - 4
omx-il/component/video/wave5/dec/SF_OMX_Vdec_decoder.c

@@ -247,6 +247,11 @@ static void OnEventArrived(Component com, unsigned long event, void *data, void
             fclose(fb);
             }
 #endif
+            if (pOMXBuffer->nFlags & OMX_BUFFERFLAG_EOS)
+            {
+                pSfOMXComponent->callbacks->EventHandler(pSfOMXComponent->pOMXComponent, pSfOMXComponent->pAppData, OMX_EventBufferFlag,
+                                                    1, pOMXBuffer->nFlags, NULL);
+            }
             pSfOMXComponent->callbacks->FillBufferDone(pSfOMXComponent->pOMXComponent, pSfOMXComponent->pAppData, pOMXBuffer);
         }
     }
@@ -343,8 +348,7 @@ static void OnEventArrived(Component com, unsigned long event, void *data, void
     case COMPONENT_EVENT_TERMINATED:
     break;
     case COMPONENT_EVENT_DEC_DECODED_ALL:
-        pSfOMXComponent->callbacks->EventHandler(pSfOMXComponent->pOMXComponent, pSfOMXComponent->pAppData, OMX_EventBufferFlag,
-                                                 1, 1, NULL);
+        LOG(SF_LOG_DEBUG,"renderer meet end\r\n");
     default:
         break;
     }
@@ -1855,7 +1859,7 @@ static void CmdThread(void *args)
                 FlushBuffer(pSfOMXComponent, nPort);
 
                 if (nPort == 0)
-                    FlushInputQ(pSfOMXComponent, pSfVideoImplement->inPauseQ);
+                    FlushInputQ(pSfOMXComponent, pSfVideoImplement->inPortQ);
                 else if (nPort == 1)
                     FlushOutputQ(pSfOMXComponent, pSfVideoImplement->outPortQ);
             }
@@ -1978,7 +1982,7 @@ static OMX_ERRORTYPE SF_OMX_ComponentConstructor(SF_OMX_COMPONENT *pSfOMXCompone
     OMX_ERRORTYPE ret = OMX_ErrorNone;
     FunctionIn();
 
-    if (nInstance >= MAX_NUM_INSTANCE)
+    if (nInstance >= 1)
     {
         ret = OMX_ErrorInsufficientResources;
         goto EXIT;