aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorywan171 <yi.a.wang@intel.com>2013-01-15 22:59:23 +0800
committerPatrick Tjin <pattjin@google.com>2014-07-21 22:03:40 -0700
commit8af4549cec855377507046127d9b9a45911eaf04 (patch)
treec352fbd9190990cf5667c270f864243685c721b7
parent85d33bdb86649f8daa474948f3224cc0a6c160ce (diff)
downloadwrs_omxil_core-8af4549cec855377507046127d9b9a45911eaf04.tar.gz
wrs_omxil_core: fix klocwork issue under wrs_omxil_core
BZ: 73428 fix Klocwork issue under wrs_omxil_core, check point before refereced Signed-off-by: ywan171 <yi.a.wang@intel.com> Change-Id: Ic5b721a5cda4dacb0b89dc28bdf9aaad605e1d5a Reviewed-on: http://android.intel.com:8080/86803 Reviewed-by: Wang, Yi A <yi.a.wang@intel.com> Reviewed-by: Feng, Wei <wei.feng@intel.com> Reviewed-by: Shi, PingX <pingx.shi@intel.com> Tested-by: Shi, PingX <pingx.shi@intel.com> Reviewed-by: cactus <cactus@intel.com> Tested-by: cactus <cactus@intel.com>
-rw-r--r--base/src/componentbase.cpp6
-rw-r--r--base/src/portvideo.cpp.rej128
-rw-r--r--utils/src/module.c14
-rw-r--r--utils/src/queue.c3
4 files changed, 14 insertions, 137 deletions
diff --git a/base/src/componentbase.cpp b/base/src/componentbase.cpp
index 81d7ae7..17e27b7 100644
--- a/base/src/componentbase.cpp
+++ b/base/src/componentbase.cpp
@@ -1730,7 +1730,7 @@ OMX_ERRORTYPE ComponentBase::AllocatePorts(void)
free_ports:
LOGE("%s(): exit, unknown component variant\n", __func__);
FreePorts();
- return ret;
+ return OMX_ErrorUndefined;
}
/* called int FreeHandle() */
@@ -1768,6 +1768,10 @@ void ComponentBase::Work(void)
OMX_U32 i;
OMX_ERRORTYPE ret;
+ if (nr_ports == 0) {
+ return;
+ }
+
pthread_mutex_lock(&ports_block);
while(IsAllBufferAvailable())
diff --git a/base/src/portvideo.cpp.rej b/base/src/portvideo.cpp.rej
deleted file mode 100644
index a49c707..0000000
--- a/base/src/portvideo.cpp.rej
+++ /dev/null
@@ -1,128 +0,0 @@
---- base/src/portvideo.cpp
-+++ base/src/portvideo.cpp
-@@ -182,17 +182,12 @@
-
- memset(&avcparam, 0, sizeof(avcparam));
-
-- //set buffer sharing mode
-+ avcparam.eProfile = OMX_VIDEO_AVCProfileVendorStartUnused; //defaul profle for buffer sharing in opencore
-+ avcparam.eLevel = OMX_VIDEO_AVCLevelVendorStartUnused; //default level for buffer sharing in opencore
-+
-+//set buffer sharing mode
- #ifdef COMPONENT_SUPPORT_BUFFER_SHARING
--#ifdef COMPONENT_SUPPORT_OPENCORE
- SetPortBufferSharingInfo(OMX_TRUE);
-- avcparam.eProfile = OMX_VIDEO_AVCProfileVendorStartUnused;
-- avcparam.eLevel = OMX_VIDEO_AVCLevelVendorStartUnused;
--#endif
--#else
-- SetPortBufferSharingInfo(OMX_FALSE);
--// avcparam.eProfile = OMX_VIDEO_AVCProfileVendorStartUnused;
--// avcparam.eLevel = OMX_VIDEO_AVCLevelVendorStartUnused;
- #endif
-
- ComponentBase::SetTypeHeader(&avcparam, sizeof(avcparam));
-@@ -243,6 +238,18 @@
- avcparam.nCabacInitIdc = p->nCabacInitIdc;
- avcparam.eLoopFilterMode = p->eLoopFilterMode;
-
-+#ifdef COMPONENT_SUPPORT_OPENCORE
-+#ifdef COMPONENT_SUPPORT_BUFFER_SHARING
-+// sepcial case ,not change default profile and level for opencore buffer sharing.
-+#else
-+ avcparam.eProfile = p->eProfile;
-+ avcparam.eLevel = p->eLevel;
-+#endif
-+#else
-+ avcparam.eProfile = p->eProfile;
-+ avcparam.eLevel = p->eLevel;
-+#endif
-+
- return OMX_ErrorNone;
- }
-
-@@ -266,17 +273,13 @@
- memset(&mpeg4param, 0, sizeof(mpeg4param));
- ComponentBase::SetTypeHeader(&mpeg4param, sizeof(mpeg4param));
-
--#ifdef COMPONENT_SUPPORT_BUFFER_SHARING
--#ifdef COMPONENT_SUPPORT_OPENCORE
-- SetPortBufferSharingInfo(OMX_TRUE);
- mpeg4param.eProfile = OMX_VIDEO_MPEG4ProfileVendorStartUnused;
- mpeg4param.eLevel = OMX_VIDEO_MPEG4LevelVendorStartUnused;
-+
-+#ifdef COMPONENT_SUPPORT_BUFFER_SHARING
-+ SetPortBufferSharingInfo(OMX_TRUE);
- #endif
--#else
-- SetPortBufferSharingInfo(OMX_FALSE);
--// mpeg4param.eProfile = OMX_VIDEO_MPEG4ProfileVendorStartUnused;
--// mpeg4param.eLevel = OMX_VIDEO_MPEG4LevelVendorStartUnused;
--#endif
-+
- }
-
- OMX_ERRORTYPE PortMpeg4::SetPortMpeg4Param(
-@@ -310,8 +313,19 @@
- mpeg4param.bACPred = p->bACPred;
- mpeg4param.nMaxPacketSize = p->nMaxPacketSize;
- mpeg4param.nTimeIncRes = p->nTimeIncRes;
-+
-+#ifdef COMPONENT_SUPPORT_OPENCORE
-+#ifdef COMPONENT_SUPPORT_BUFFER_SHARING
-+// sepcial case ,not change default profile and level for opencore buffer sharing.
-+#else
- mpeg4param.eProfile = p->eProfile;
- mpeg4param.eLevel = p->eLevel;
-+#endif
-+#else
-+ mpeg4param.eProfile = p->eProfile;
-+ mpeg4param.eLevel = p->eLevel;
-+#endif
-+
- mpeg4param.nAllowedPictureTypes = p->nAllowedPictureTypes;
- mpeg4param.nHeaderExtension = p->nHeaderExtension;
- mpeg4param.bReversibleVLC = p->bReversibleVLC;
-@@ -339,16 +353,11 @@
- memset(&h263param, 0, sizeof(h263param));
-
- //set buffer sharing mode
--#ifdef COMPONENT_SUPPORT_BUFFER_SHARING
--#ifdef COMPONENT_SUPPORT_OPENCORE
-- SetPortBufferSharingInfo(OMX_TRUE);
- h263param.eProfile = OMX_VIDEO_H263ProfileVendorStartUnused;
- h263param.eLevel = OMX_VIDEO_H263LevelVendorStartUnused;
--#endif
--#else
-- SetPortBufferSharingInfo(OMX_FALSE);
--// h263param.eProfile = OMX_VIDEO_H263ProfileVendorStartUnused;
--// h263param.eLevel = OMX_VIDEO_H263LevelVendorStartUnused;
-+
-+#ifdef COMPONENT_SUPPORT_BUFFER_SHARING
-+ SetPortBufferSharingInfo(OMX_TRUE);
- #endif
-
- ComponentBase::SetTypeHeader(&h263param, sizeof(h263param));
-@@ -378,8 +387,20 @@
-
- h263param.nPFrames = p->nPFrames;
- h263param.nBFrames = p->nBFrames;
--// h263param.eProfile = p->eProfile;
--// h263param.eLevel = p->eLevel;
-+
-+
-+#ifdef COMPONENT_SUPPORT_OPENCORE
-+#ifdef COMPONENT_SUPPORT_BUFFER_SHARING
-+// sepcial case ,not change default profile and level for opencore buffer sharing.
-+#else
-+ h263param.eProfile = p->eProfile;
-+ h263param.eLevel = p->eLevel;
-+#endif
-+#else
-+ h263param.eProfile = p->eProfile;
-+ h263param.eLevel = p->eLevel;
-+#endif
-+
- h263param.bPLUSPTYPEAllowed = p->bPLUSPTYPEAllowed;
- h263param.nAllowedPictureTypes = p->nAllowedPictureTypes;
- h263param.bForceRoundingTypeToZero = p->bForceRoundingTypeToZero;
diff --git a/utils/src/module.c b/utils/src/module.c
index 5f5f49d..053e5e0 100644
--- a/utils/src/module.c
+++ b/utils/src/module.c
@@ -167,10 +167,15 @@ struct module *module_open(const char *file, int flag)
return existing;
}
+ new->name = strdup(file);
+ if (!new->name) {
+ goto free_handle;
+ }
+
dlerror();
new->init = dlsym(new->handle, "module_init");
dlerr = dlerror();
- if (!dlerr) {
+ if (!dlerr && new->init) {
LOGE("module %s has init(), call the symbol\n", new->name);
init_ret = new->init(new);
}
@@ -187,13 +192,6 @@ struct module *module_open(const char *file, int flag)
if (dlerr)
new->exit = NULL;
- new->name = strdup(file);
- if (!new->name) {
- if (new->exit)
- new->exit(new);
- goto free_handle;
- }
-
g_module_head = module_add_list(g_module_head, new);
pthread_mutex_unlock(&g_lock);
diff --git a/utils/src/queue.c b/utils/src/queue.c
index 6e54502..015fbf7 100644
--- a/utils/src/queue.c
+++ b/utils/src/queue.c
@@ -78,6 +78,9 @@ int queue_push_head(struct queue *queue, void *data)
void __queue_push_tail(struct queue *queue, struct list *entry)
{
+ if (!entry) {
+ return ;
+ }
queue->tail = list_add_tail(queue->tail, entry);
if (queue->tail->next)
queue->tail = queue->tail->next;