aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorywan171 <yi.a.wang@intel.com>2012-06-06 13:52:39 +0800
committerPatrick Tjin <pattjin@google.com>2014-07-21 22:03:39 -0700
commitb075b83b34ab602a1583879948042d697b43b58a (patch)
treeca10f69473a143fb986227947c2a73ec29238034
parentb3e4883725f0e186dd80503bedd9999770233182 (diff)
downloadwrs_omxil_core-b075b83b34ab602a1583879948042d697b43b58a.tar.gz
[PORT FROM R3]wrs_omxil_core: flush Processor before flush port for video decoder
BZ: 38132 lock the FlushPort and ProcessorFlush function together in case fillBuffer occurs between FlushPort and ProcessFlush and makes renderdone flag dirty. Signed-off-by: ywan171 <yi.a.wang@intel.com> Change-Id: Iafda19c5a9050d203de629af6199a5abd498f2e2 Orig-Change-Id: I6f8eb2c826fabb7de01738573b2fce0c57fe56bc Reviewed-on: http://android.intel.com:8080/51060 Reviewed-by: Qiu, Junhai <junhai.qiu@intel.com> Reviewed-by: Ding, Haitao <haitao.ding@intel.com> Tested-by: Ding, Haitao <haitao.ding@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
-rw-r--r--base/src/componentbase.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/base/src/componentbase.cpp b/base/src/componentbase.cpp
index 7f80f47..31aa979 100644
--- a/base/src/componentbase.cpp
+++ b/base/src/componentbase.cpp
@@ -1296,10 +1296,9 @@ void ComponentBase::CmdHandler(struct cmd_s *cmd)
}
case OMX_CommandFlush: {
OMX_U32 port_index = cmd->param1;
-
- FlushPort(port_index, 1);
pthread_mutex_lock(&ports_block);
ProcessorFlush(port_index);
+ FlushPort(port_index, 1);
pthread_mutex_unlock(&ports_block);
break;
}
@@ -1497,7 +1496,9 @@ inline OMX_ERRORTYPE ComponentBase::TransStateToIdle(OMX_STATETYPE current)
}
}
else if ((current == OMX_StatePause) || (current == OMX_StateExecuting)) {
+ pthread_mutex_lock(&ports_block);
FlushPort(OMX_ALL, 0);
+ pthread_mutex_unlock(&ports_block);
LOGV("%s:%s: flushed all ports\n", GetName(), GetWorkingRole());
bufferwork->CancelScheduledWork(this);
@@ -1695,14 +1696,12 @@ void ComponentBase::FlushPort(OMX_U32 port_index, bool notify)
LOGV("%s:%s: flush ports (from index %lu to %lu)\n",
GetName(), GetWorkingRole(), from_index, to_index);
- pthread_mutex_lock(&ports_block);
for (i = from_index; i <= to_index; i++) {
ports[i]->FlushPort();
if (notify)
callbacks->EventHandler(handle, appdata, OMX_EventCmdComplete,
OMX_CommandFlush, i, NULL);
}
- pthread_mutex_unlock(&ports_block);
LOGV("%s:%s: flush ports done\n", GetName(), GetWorkingRole());
}
@@ -1911,7 +1910,7 @@ void ComponentBase::Work(void)
retain[i] = BUFFER_RETAIN_NOT_RETAIN;
}
- if (!strncmp((char*)working_role, "video_decoder", 13)){
+ if (working_role != NULL && !strncmp((char*)working_role, "video_decoder", 13)){
ret = ProcessorProcess(buffers, &retain[0], nr_ports);
}else{
ret = ProcessorProcess(buffers_hdr, &retain[0], nr_ports);