From 1cd54c508ada7f61e878c9a0faf42bbd791c8cec Mon Sep 17 00:00:00 2001 From: Mahesh Lanka Date: Wed, 19 Jul 2017 15:54:01 +0530 Subject: [PATCH] mm-video-v4l2: vdec: change notify flush done to client Component doesn't support flush on single port, Internally it calls flush on both ports though client request on single port. Hence notify flush done to client after flush on all the ports has been completed. author : Manikanta Kanamarlapudi CRs-Fixed: 2076660 Test: make cts -j123 && cts-tradefed run cts-dev -m \ CtsMediaTestCases --compatibility:module-arg \ CtsMediaTestCases:include-annotation:\ android.platform.test.annotations.RequiresDevice Bug: 63603864 Merged-In: I319f42a02361a74d7c0c51215f6bdaa7a1c2a2d6 Change-Id: I319f42a02361a74d7c0c51215f6bdaa7a1c2a2d6 --- .../mm-video-v4l2/vidc/vdec/inc/omx_vdec.h | 1 + .../vidc/vdec/src/omx_vdec_v4l2.cpp | 51 +++++++++++++------ 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/msm8996/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h b/msm8996/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h index 95b9621d..b5807cca 100644 --- a/msm8996/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h +++ b/msm8996/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h @@ -638,6 +638,7 @@ class omx_vdec: public qc_omx_component bool execute_omx_flush(OMX_U32); bool execute_output_flush(); bool execute_input_flush(); + void notify_flush_done(void *ctxt); OMX_ERRORTYPE empty_buffer_done(OMX_HANDLETYPE hComp, OMX_BUFFERHEADERTYPE * buffer); diff --git a/msm8996/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp b/msm8996/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp index 22e84445..b2ca45c7 100644 --- a/msm8996/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp +++ b/msm8996/mm-video-v4l2/vidc/vdec/src/omx_vdec_v4l2.cpp @@ -1395,14 +1395,8 @@ void omx_vdec::process_event_cb(void *ctxt, unsigned char id) pThis->omx_report_error (); } else { /*Check if we need generate event for Flush done*/ - if (BITMASK_PRESENT(&pThis->m_flags, - OMX_COMPONENT_INPUT_FLUSH_PENDING)) { - BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_INPUT_FLUSH_PENDING); - DEBUG_PRINT_LOW("Input Flush completed - Notify Client"); - pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, - OMX_EventCmdComplete,OMX_CommandFlush, - OMX_CORE_INPUT_PORT_INDEX,NULL ); - } + pThis->notify_flush_done(ctxt); + if (BITMASK_PRESENT(&pThis->m_flags, OMX_COMPONENT_IDLE_PENDING)) { if (pThis->stream_off(OMX_CORE_INPUT_PORT_INDEX)) { @@ -1436,14 +1430,8 @@ void omx_vdec::process_event_cb(void *ctxt, unsigned char id) pThis->omx_report_error (); } else { /*Check if we need generate event for Flush done*/ - if (BITMASK_PRESENT(&pThis->m_flags, - OMX_COMPONENT_OUTPUT_FLUSH_PENDING)) { - DEBUG_PRINT_LOW("Notify Output Flush done"); - BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_OUTPUT_FLUSH_PENDING); - pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, - OMX_EventCmdComplete,OMX_CommandFlush, - OMX_CORE_OUTPUT_PORT_INDEX,NULL ); - } + pThis->notify_flush_done(ctxt); + if (BITMASK_PRESENT(&pThis->m_flags, OMX_COMPONENT_OUTPUT_FLUSH_IN_DISABLE_PENDING)) { DEBUG_PRINT_LOW("Internal flush complete"); @@ -3281,6 +3269,37 @@ bool omx_vdec::execute_input_flush() return bRet; } +/*========================================================================= +FUNCTION : notify_flush_done +DESCRIPTION +Notifies flush done to the OMX Client. +PARAMETERS +ctxt -- Context information related to the self.. +RETURN VALUE +NONE +==========================================================================*/ +void omx_vdec::notify_flush_done(void *ctxt) { + omx_vdec *pThis = (omx_vdec *) ctxt; + if (!pThis->input_flush_progress && !pThis->output_flush_progress) { + if (BITMASK_PRESENT(&pThis->m_flags, + OMX_COMPONENT_OUTPUT_FLUSH_PENDING)) { + DEBUG_PRINT_LOW("Notify Output Flush done"); + BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_OUTPUT_FLUSH_PENDING); + pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, + OMX_EventCmdComplete,OMX_CommandFlush, + OMX_CORE_OUTPUT_PORT_INDEX,NULL ); + } + + if (BITMASK_PRESENT(&pThis->m_flags, + OMX_COMPONENT_INPUT_FLUSH_PENDING)) { + BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_INPUT_FLUSH_PENDING); + DEBUG_PRINT_LOW("Input Flush completed - Notify Client"); + pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, + OMX_EventCmdComplete,OMX_CommandFlush, + OMX_CORE_INPUT_PORT_INDEX,NULL ); + } + } +} /* ====================================================================== FUNCTION