From b1fcbe1304402836e43430422abd2b05224163f4 Mon Sep 17 00:00:00 2001 From: Sejun Park Date: Wed, 11 Oct 2017 17:40:17 +0900 Subject: [PATCH] fixed coverity issues Change-Id: I5dffc84634b32c59068ccb79f975cc379cb40775 --- omx/gstomx.c | 2 +- omx/gstomxvideoenc.c | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/omx/gstomx.c b/omx/gstomx.c index 9980b77..07822b3 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -1853,7 +1853,7 @@ gst_omx_port_tbm_allocate_dec_buffers (GstOMXPort * port, tbm_bufmgr bufmgr, gbo stride[1] = info.planes[1].stride; tbm_surface_destroy (surface); - if ((stride[0] <= 0) || (stride[1] <= 0)) + if ((planes[0] <= 0) || (planes[1] <= 0) || (stride[0] <= 0) || (stride[1] <= 0)) return OMX_ErrorUndefined; } diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 617eb21..0c84e6f 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -592,9 +592,6 @@ gst_omx_video_enc_change_state (GstElement * element, GstStateChange transition) break; } - if (ret == GST_STATE_CHANGE_FAILURE) - return ret; - ret = GST_ELEMENT_CLASS (gst_omx_video_enc_parent_class)->change_state (element, transition); @@ -1591,14 +1588,14 @@ gst_omx_video_enc_fill_buffer (GstOMXVideoEnc * self, GstBuffer * inbuf, GST_LOG_OBJECT (self, "enc. fd[0]:%d fd[1]:%d a[0]:%p, a[1]:%p, w[0]:%d h[0]:%d %d, %d, buf_share_method:%d", mm_vbuffer->handle.dmabuf_fd[0], mm_vbuffer->handle.dmabuf_fd[1], mm_vbuffer->data[0], mm_vbuffer->data[1], mm_vbuffer->width[0], mm_vbuffer->height[0], mm_vbuffer->width[1], mm_vbuffer->height[1], mm_vbuffer->type); + + outbuf->omx_buf->nAllocLen = sizeof (MMVideoBuffer); + outbuf->omx_buf->nFilledLen = sizeof (MMVideoBuffer); + memcpy (outbuf->omx_buf->pBuffer, mm_vbuffer, sizeof (MMVideoBuffer)); } else { GST_WARNING_OBJECT (self, "enc input has wrong buf"); } - outbuf->omx_buf->nAllocLen = sizeof (MMVideoBuffer); - outbuf->omx_buf->nFilledLen = sizeof (MMVideoBuffer); - memcpy (outbuf->omx_buf->pBuffer, mm_vbuffer, sizeof (MMVideoBuffer)); - #ifdef CODEC_ENC_INPUT_DUMP gst_omx_video_enc_input_dump(mm_vbuffer); #endif -- 2.7.4