[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-datatype-cvs
Subject:    [Datatype-cvs] omx/common CBaseOmxDec.cpp, 1.1.2.18.4.1,
From:       zlin () helixcommunity ! org
Date:       2011-03-30 9:26:22
Message-ID: 201103300926.p2U9Q5Wi017344 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/datatype/omx/common
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv24737

Modified Files:
      Tag: hxclient_3_6_5_atlas
	CBaseOmxDec.cpp 
Log Message:
Synopsis: On 8650a platform, some dropped frames are shown on screen before seek \
operation complete.

Overview: For each frame, video site call postBuffer(offset) to let it shown on \
screen. After this, surface flinger has some kind of connection with this frame \
buffer. During seek operation, Helix do not call postBuffer before desired seek \
point. However, we can see some dropped frames by Helix shown on screen. In order to \
avoid this issue, change to hold 1 frame buffer while doing seek operation. Change \
IHXVideoSurface interface to add a api, to let video site know when it is time to \
seek(OnPreSeek). In CMiniAndroidSurface::OnPreSeek, flag the last frame which is \
shown on screen. After that, when flush begin in OMX wrapper, it will check which \
frame is being shown on screen and do not return it back to OMX decoder


Index: CBaseOmxDec.cpp
===================================================================
RCS file: /cvsroot/datatype/omx/common/CBaseOmxDec.cpp,v
retrieving revision 1.1.2.18.4.1
retrieving revision 1.1.2.18.4.2
diff -u -d -r1.1.2.18.4.1 -r1.1.2.18.4.2
--- CBaseOmxDec.cpp	28 Mar 2011 10:35:47 -0000	1.1.2.18.4.1
+++ CBaseOmxDec.cpp	30 Mar 2011 09:26:20 -0000	1.1.2.18.4.2
@@ -103,6 +103,7 @@
 
 CBaseOMXDec::CBaseOMXDec():
 m_pOMXEvent(NULL)
+,m_pStateEvent(NULL)
 ,m_pBufferDoneEvent(NULL)
 ,m_pInputBufferLock(NULL)
 ,m_pOutputBufferLock(NULL)
@@ -131,6 +132,7 @@
         m_pReuseQueue = NULL;
     }
     HX_RELEASE(m_pOMXEvent);
+    HX_RELEASE(m_pStateEvent);
     HX_RELEASE(m_pBufferDoneEvent);
     HX_RELEASE(m_pInputBufferLock);
     HX_RELEASE(m_pOutputBufferLock);
@@ -151,6 +153,8 @@
                 case OMX_CommandStateSet:
                     m_eDecoderState = (OMX_STATETYPE)Data2;
                     //fallthrough
+                    m_pStateEvent->SignalEvent();	
+                    break;
                 case OMX_CommandPortDisable:
                 case OMX_CommandPortEnable:
                     //signal to main thread that command has completed
@@ -241,7 +245,7 @@
         ret = OMX_SendCommand(m_hDecoder, OMX_CommandStateSet, OMX_StateIdle, NULL);
         OmxError(ret)
         // wait for IDLE state command to complete
-        m_pOMXEvent->Wait(ALLFS);
+        m_pStateEvent->Wait(ALLFS);
     }
     else if (m_eDecoderState == OMX_StateInvalid)
     {
@@ -278,7 +282,7 @@
     if (m_eDecoderState != OMX_StateInvalid)
     {
         // wait for LOADED state command to complete
-        m_pOMXEvent->Wait(ALLFS);    
+        m_pStateEvent->Wait(ALLFS);   
     }
 
 done:
@@ -319,6 +323,9 @@
     CreateEventCCF((void**)&m_pOMXEvent, (IUnknown*)m_pCCF, "", FALSE);
     CheckError(m_pCCF)
 
+    CreateEventCCF((void**)&m_pStateEvent, (IUnknown*)m_pCCF, "", FALSE);
+    CheckError(m_pCCF)
+
     CreateEventCCF((void**)&m_pBufferDoneEvent, (IUnknown*)m_pCCF, "", FALSE);
     CheckError(m_pBufferDoneEvent)
     
@@ -395,11 +402,11 @@
     OmxError(ret)
     InitBuffers();
     // wait for Idle state command to complete
-    m_pOMXEvent->Wait(ALLFS);
+    m_pStateEvent->Wait(ALLFS);
     ret = OMX_SendCommand(m_hDecoder, OMX_CommandStateSet, OMX_StateExecuting, \
                NULL);
-    OmxError(ret)
+    OmxError(ret);
     // wait for Executing state command to complete
-    m_pOMXEvent->Wait(ALLFS);
+    m_pStateEvent->Wait(ALLFS);
     m_bPendingPortReconfig = FALSE;
     //send all output buffers to decoder
     while (m_outputBufferList.GetCount() > 0)
@@ -507,6 +514,8 @@
     return hxr;
 }
 
+
+
 HX_RESULT 
 CBaseOMXDec::ReUse(OMX_BUFFERHEADERTYPE*& pBuffer)
 {
@@ -641,23 +650,26 @@
 void 
 CBaseOMXDec::Flush()
 {
-  if (m_eDecoderState == OMX_StateExecuting)
-  {
-    FlushReuseQueue();
-    //Flush Both Ports
-    m_uFlushState = FLUSHSTART;
-    OMX_SendCommand(m_hDecoder, OMX_CommandFlush, -1, NULL);
-    m_pOMXEvent->Wait(ALLFS);
-    m_pOutputBufferLock->Lock();
-    while (m_outputBufferList.GetCount() > 0)
+    if (m_eDecoderState == OMX_StateExecuting)
     {
-       OMX_BUFFERHEADERTYPE* pBuffer = \
                (OMX_BUFFERHEADERTYPE*)m_outputBufferList.RemoveHead();
-       pBuffer->nOffset = 0;
-       pBuffer->nFilledLen = 0;
-       OMX_FillThisBuffer(m_hDecoder, pBuffer);       
-    }
-    m_pOutputBufferLock->Unlock();
-  }
+        // During flush, remain the frame which has been tied with surface flinger
+        // Do not return this frame to OMX decoder, because this frame can show its
+        // Content onto screen even without our postBuffer calling
+        FlushReuseQueue(1);
+        //Flush Both Ports
+        m_uFlushState = FLUSHSTART;
+        OMX_SendCommand(m_hDecoder, OMX_CommandFlush, -1, NULL);
+        m_pOMXEvent->Wait(ALLFS);
+        m_pOutputBufferLock->Lock();
+        while (m_outputBufferList.GetCount() > 0)
+        {
+           OMX_BUFFERHEADERTYPE* pBuffer = \
(OMX_BUFFERHEADERTYPE*)m_outputBufferList.RemoveHead(); +           pBuffer->nOffset \
= 0; +           pBuffer->nFilledLen = 0;
+           OMX_FillThisBuffer(m_hDecoder, pBuffer);       
+        }
+        m_pOutputBufferLock->Unlock();
+     }
 }
 
 OMX_ERRORTYPE
@@ -716,11 +728,16 @@
 }
 
 HX_RESULT
-CBaseOMXDec::FlushReuseQueue()
+CBaseOMXDec::FlushReuseQueue(int remain)
 {
-    while(m_pReuseQueue->GetCount() > 0)
+    while(m_pReuseQueue->GetCount() > remain)
     {
         COMXFrameObject* pFrame = (COMXFrameObject*)(m_pReuseQueue->RemoveHead());
+        if (remain && pFrame->GetRemainDuringSeek())
+        {
+            m_pReuseQueue->AddTail((void*)pFrame);
+            continue;
+        }
         pFrame->ReleaseBuffer(FALSE);
         pFrame->Release();
     }
@@ -742,6 +759,7 @@
     HX_RESULT ret = HXR_FAIL;
     if (!pRemove) return ret;
     COMXFrameObject* pFrame = NULL;
+    HXBOOL bFound = FALSE;
     LISTPOSITION i = m_pReuseQueue->GetHeadPosition();
     while (i)
     {
@@ -750,10 +768,15 @@
         {
             m_pReuseQueue->RemoveAt(i);
             pFrame->Release();
+            bFound = TRUE;
             ret = HXR_OK;
             break;
         }
         m_pReuseQueue->GetNext(i);
     }
+    if (!bFound && pRemove)
+    {
+        pRemove->Release();
+    }
     return ret; 
 }


_______________________________________________
Datatype-cvs mailing list
Datatype-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/datatype-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic