OSDN Git Service

auto import from //branches/cupcake_rel/...@141571
authorThe Android Open Source Project <initial-contribution@android.com>
Fri, 20 Mar 2009 06:08:53 +0000 (23:08 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Fri, 20 Mar 2009 06:08:53 +0000 (23:08 -0700)
Config.mk
nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_node.cpp
nodes/pvomxvideoencnode/src/pvmf_omx_videoenc_port.cpp

index 957ae40..a5d6036 100644 (file)
--- a/Config.mk
+++ b/Config.mk
@@ -13,17 +13,16 @@ ifndef EXTERNAL_OPENCORE_CONFIG_ONCE
   # However for debugging with gdb you may want to set PV_OSCL_LIB to
   # false to disable this custom loader.
   PV_OSCL_LIB := true
-  VALUE_ADD := false
   ifeq ($(PV_OSCL_LIB), true)
     PV_CFLAGS += -DHAS_OSCL_LIB_SUPPORT
+  endif
 
-    alternate_config := $(if $(wildcard vendor/pv/pvplayer.conf),true)
-    ifeq ($(alternate_config), true)
-      VALUE_ADD := true
-      PV_CFLAGS += -DPV_USE_VALUE_ADD=1
-    endif
+  # To enable the windows codecs under vendor/pv, define VALUE_ADD to true.
+  # You need HAS_OSCL_LIB_SUPPORT as well for VALUE_ADD modules.
+  VALUE_ADD := true
+  ifeq ($(VALUE_ADD), true)
+    PV_CFLAGS += -DPV_USE_VALUE_ADD=1
   endif
-  alternate_config :=
 
   PV_COPY_HEADERS_TO := libpv
 
index 2581003..aed53aa 100644 (file)
@@ -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;
                 }
index 7fe8cbd..163d0eb 100644 (file)
@@ -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();
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////