From: Sangchul Lee Date: Mon, 23 Aug 2021 03:09:13 +0000 (+0900) Subject: webrtc_display: Check return value of gst_video_info_from_caps() X-Git-Tag: submit/tizen/20210823.105019^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3293084ded8c252dbe43e08a4079256388fc751f;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_display: Check return value of gst_video_info_from_caps() [Version] 0.2.79 [Issue Type] Coverity (CHECKED_RETURN) Change-Id: I6c7ff1dfc4c2352122c57c5a53fa160928033cec Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 3c0f86a7..040f1cbe 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.2.78 +Version: 0.2.79 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_display.c b/src/webrtc_display.c index 9778de0f..1a1d79db 100644 --- a/src/webrtc_display.c +++ b/src/webrtc_display.c @@ -267,31 +267,34 @@ static video_decoded_data_info_s *__get_decoded_data_info_from_pad(GstPad *pad) unsigned int fourcc = 0; const gchar *string_format; video_decoded_data_info_s *info; - gint width, height; MMPixelFormatType format; GstVideoInfo vinfo; caps = gst_pad_get_current_caps(pad); RET_VAL_IF(caps == NULL, NULL, "caps is NULL"); + if (!gst_video_info_from_caps(&vinfo, caps)) { + gst_caps_unref(caps); + LOG_ERROR("failed to gst_video_info_from_caps()"); + return NULL; + } + structure = gst_caps_get_structure(caps, 0); - gst_structure_get_int(structure, "width", &width); - gst_structure_get_int(structure, "height", &height); string_format = gst_structure_get_string(structure, "format"); if (string_format) fourcc = __convert_fourcc_string_to_value(string_format); format = __get_pixel_format(fourcc); - gst_video_info_from_caps(&vinfo, caps); + gst_caps_unref(caps); - RET_VAL_IF(width == 0, NULL, "width is 0"); - RET_VAL_IF(height == 0, NULL, "height is 0"); + RET_VAL_IF(vinfo.width == 0, NULL, "width is 0"); + RET_VAL_IF(vinfo.height == 0, NULL, "height is 0"); RET_VAL_IF(format == MM_PIXEL_FORMAT_INVALID, NULL, "pixel format is invalid"); info = g_new0(video_decoded_data_info_s, 1); - info->width = width; - info->height = height; + info->width = vinfo.width; + info->height = vinfo.height; info->format = format; info->plane_num = GST_VIDEO_INFO_N_PLANES(&vinfo);