From: James Dong <> Date: Wed, 25 Mar 2009 02:02:50 +0000 (-0700) Subject: Automated import from //branches/donutburger/...@140956,140956 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6a515a1bddaf8678beeb23c1f0081b1b434143b9;p=android-x86%2Fexternal-opencore.git Automated import from //branches/donutburger/...@140956,140956 --- diff --git a/nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_node.cpp b/nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_node.cpp index 25810034..aed53aa2 100644 --- a/nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_node.cpp +++ b/nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_node.cpp @@ -102,6 +102,7 @@ OMX_ERRORTYPE CallbackEventHandler(OMX_OUT OMX_HANDLETYPE aComponent, OMX_OUT OMX_U32 aData2, OMX_OUT OMX_PTR aEventData) { + LOGD("PVMFOMXVideoEncNode::CallbackEventHandler: event(%d), data1(%ld) and data2(%ld)", aEvent, aData1, aData2); PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, PVLogger::GetLoggerObject("PVMFOMXVideoEncNode"), PVLOGMSG_STACK_TRACE, (0, "PVMFOMXVideoEncNode::CallbackEventHandler: In")); PVMFOMXVideoEncNode *Node = (PVMFOMXVideoEncNode *) aAppData; @@ -258,7 +259,7 @@ PVMFOMXVideoEncNode::PVMFOMXVideoEncNode(int32 aPriority) : iOMXVideoEncoder = NULL; // Current State of the component - OMX_STATETYPE iCurrentEncoderState = OMX_StateInvalid; + iCurrentEncoderState = OMX_StateInvalid; // Shared pointer for Media Msg.Input buffer // PVMFSharedMediaDataPtr iDataIn; //Init this value ? @@ -2083,8 +2084,12 @@ bool PVMFOMXVideoEncNode::IsFlushPending() void PVMFOMXVideoEncNode::FlushComplete() { LOG_STACK_TRACE((0, "PVMFOMXVideoEncNode::FlushComplete")); + bool flushCompleted = (mInputBufferRefCount == 0 && + iCurrentEncoderState == OMX_StateIdle && + (iCurrentCmd.size() > 0 && iCurrentCmd.front().iCmd == PVMF_GENERIC_NODE_FLUSH)); + if (!flushCompleted) return; + uint32 i = 0; - // flush completes only when all queues of all ports are clear. // otherwise, just return from this method and wait for FlushComplete // from the remaining ports. @@ -2265,7 +2270,7 @@ void PVMFOMXVideoEncNode::DoReset(PVMFVideoEncNodeCommand& aCmd) } iCmdQueue.Erase(&aCmd); iResetInProgress = true; - + PVMFStatus status = PVMFSuccess; // free input and output buffers LOG_STACK_TRACE((0,"PVMFOMXVideoEncNode::DoReset(): free output buffers")); if (iOutputBuffersFreed == false) @@ -2278,7 +2283,7 @@ void PVMFOMXVideoEncNode::DoReset(PVMFVideoEncNodeCommand& aCmd) )) { LOG_ERR((0,"PVMFOMXVideoEncNode::DoReset(): cannot free output buffers ")); - CommandComplete(iCurrentCmd, iCurrentCmd.front(), PVMFErrResource); + status = PVMFErrResource; } } @@ -2293,13 +2298,18 @@ void PVMFOMXVideoEncNode::DoReset(PVMFVideoEncNodeCommand& aCmd) )) { LOG_ERR((0,"PVMFOMXVideoEncNode::DoReset(): cannot free input buffers ")); - CommandComplete(iCurrentCmd, iCurrentCmd.front(), PVMFErrResource); + status = PVMFErrResource; } } iEndOfDataReached = false; iIsEOSSentToComponent = false; iIsEOSReceivedFromComponent = false; + if (status != PVMFSuccess) + { + iResetInProgress = false; + CommandComplete(iCurrentCmd, iCurrentCmd.front(), status); + } } return; } diff --git a/nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_port.cpp b/nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_port.cpp index 7fe8cbd2..163d0eba 100644 --- a/nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_port.cpp +++ b/nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_port.cpp @@ -402,12 +402,6 @@ void PVMFVideoEncPort::Run() break; } } - - if(iNode->IsFlushPending()) - { - if(IncomingMsgQueueSize() == 0 && OutgoingMsgQueueSize() == 0) - iNode->FlushComplete(); - } } //Process outgoing messages @@ -439,21 +433,15 @@ void PVMFVideoEncPort::Run() iNode->ReportErrorEvent(PVMF_OMX_VIDEOENC_NODE_ERROR_ENCODE_ERROR, (OsclAny*)this); break; } - - if(iNode->IsFlushPending()) - { - if(IncomingMsgQueueSize() == 0 && OutgoingMsgQueueSize() == 0) - iNode->FlushComplete(); - } } } - - if(iNode->IsFlushPending()) - { - if(IncomingMsgQueueSize() == 0 && OutgoingMsgQueueSize() == 0) - iNode->FlushComplete(); - } } + + if (iNode->IsFlushPending()) + { + if (IncomingMsgQueueSize() == 0 && OutgoingMsgQueueSize() == 0) + iNode->FlushComplete(); + } } ////////////////////////////////////////////////////////////////////////////