From 4b4e6f02bade0a85b35e8df306c6975e19875e0f Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Mon, 20 Nov 2023 11:26:17 +0900 Subject: [PATCH] Fix coverity issue - UNCHECKED_RETURN [Version] 0.6.34 [Issue Type] Coverity Change-Id: I7abaec8c1e32f54329024381ce9a2f8d3d5b0553 Signed-off-by: Jeongmo Yang --- packaging/capi-media-codec.spec | 2 +- src/media_codec_port.c | 19 ++++++++++++++----- src/media_codec_port_gst.c | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/packaging/capi-media-codec.spec b/packaging/capi-media-codec.spec index 36ff021..ea359b4 100644 --- a/packaging/capi-media-codec.spec +++ b/packaging/capi-media-codec.spec @@ -4,7 +4,7 @@ Name: capi-media-codec Summary: A Media Codec library in Tizen Native API -Version: 0.6.33 +Version: 0.6.34 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/media_codec_port.c b/src/media_codec_port.c index ee24d4d..34c0d7f 100644 --- a/src/media_codec_port.c +++ b/src/media_codec_port.c @@ -270,7 +270,7 @@ int mc_set_aenc_info(MMHandleType mediacodec, int samplerate, int channel, int b int mc_configure(MMHandleType mediacodec, media_format_h format, int flags) { - int ret = MC_ERROR_NONE; + int ret = MEDIA_FORMAT_ERROR_NONE; mc_handle_t *mc_handle = (mc_handle_t *) mediacodec; int i; const int codec_mask = 0xFFF0; @@ -296,7 +296,11 @@ int mc_configure(MMHandleType mediacodec, media_format_h format, int flags) } if (type == MEDIA_FORMAT_AUDIO) { - media_format_get_audio_info(format, &mimetype, &channel, &samplerate, &bit, &bitrate); + ret = media_format_get_audio_info(format, &mimetype, &channel, &samplerate, &bit, &bitrate); + if (ret != MEDIA_FORMAT_ERROR_NONE) { + LOGE("get audio info failed[0x%x]", ret); + return MC_INVALID_ARG; + } codec_id = mimetype & codec_mask; @@ -325,8 +329,13 @@ int mc_configure(MMHandleType mediacodec, media_format_h format, int flags) return MC_PARAM_ERROR; } } else if (type == MEDIA_FORMAT_VIDEO) { - media_format_get_video_info(format, &mimetype, &width, &height, &bitrate, NULL); - media_format_get_video_frame_rate(format, &fps); + ret = media_format_get_video_info(format, &mimetype, &width, &height, &bitrate, NULL); + ret |= media_format_get_video_frame_rate(format, &fps); + if (ret != MEDIA_FORMAT_ERROR_NONE) { + LOGE("get video info/frame_rate failed[0x%x]", ret); + return MC_INVALID_ARG; + } + codec_id = mimetype & codec_mask; if (GET_IS_ENCODER(flags)) { @@ -382,7 +391,7 @@ int mc_configure(MMHandleType mediacodec, media_format_h format, int flags) LOGD("encoder : %d, hardware : %d, codec_id : %x, video : %d", mc_handle->is_encoder, mc_handle->is_hw, mc_handle->codec_id, mc_handle->is_video); - return ret; + return MC_ERROR_NONE; } int mc_prepare(MMHandleType mediacodec) diff --git a/src/media_codec_port_gst.c b/src/media_codec_port_gst.c index 52ac3dc..c05b084 100644 --- a/src/media_codec_port_gst.c +++ b/src/media_codec_port_gst.c @@ -1082,6 +1082,7 @@ static void mc_gst_port_free(mc_gst_port_t *port) gboolean _mc_update_packet_info(mc_gst_core_t *core, media_format_h format) { + int ret = MEDIA_FORMAT_ERROR_NONE; gint bitrate = 0; gboolean is_format_change = FALSE; @@ -1094,8 +1095,12 @@ gboolean _mc_update_packet_info(mc_gst_core_t *core, media_format_h format) gchar *sformat = NULL; media_format_mimetype_e mimetype = 0; - media_format_get_video_info(format, &mimetype, &width, &height, &bitrate, NULL); - media_format_get_video_frame_rate(format, &framerate); + ret = media_format_get_video_info(format, &mimetype, &width, &height, &bitrate, NULL); + ret |= media_format_get_video_frame_rate(format, &framerate); + if (ret != MEDIA_FORMAT_ERROR_NONE) { + LOGE("get video info/frame_rate failed[0x%x]", ret); + return FALSE; + } is_format_change |= input_port_def->info.video.width != width; is_format_change |= input_port_def->info.video.height != height; @@ -1127,7 +1132,11 @@ gboolean _mc_update_packet_info(mc_gst_core_t *core, media_format_h format) gint samplerate; gint bit; - media_format_get_audio_info(format, NULL, &channel, &samplerate, &bit, &bitrate); + ret = media_format_get_audio_info(format, NULL, &channel, &samplerate, &bit, &bitrate); + if (ret != MEDIA_FORMAT_ERROR_NONE) { + LOGE("get audio info failed[0x%x]", ret); + return FALSE; + } is_format_change |= input_port_def->info.audio.channel != channel; is_format_change |= input_port_def->info.audio.samplerate != samplerate; -- 2.7.4