webrtc_display: Check return value of gst_video_info_from_caps() 77/262877/1 accepted/tizen/unified/20210824.123743 submit/tizen/20210823.105019
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 23 Aug 2021 03:09:13 +0000 (12:09 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 23 Aug 2021 03:09:23 +0000 (12:09 +0900)
[Version] 0.2.79
[Issue Type] Coverity (CHECKED_RETURN)

Change-Id: I6c7ff1dfc4c2352122c57c5a53fa160928033cec
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc_display.c

index 3c0f86a729d7f206e54597356a839c23dd3883bb..040f1cbe45b40f85852cfacfa1e2481a17684d0e 100644 (file)
@@ -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
index 9778de0fbf9200efc149cf1a5cae9c4dea02fac0..1a1d79db5567c87900f99c012bc92338d042c43c 100644 (file)
@@ -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);