Fix Coverity issue 95/260895/2 accepted/tizen/6.5/unified/20211028.123843 accepted/tizen/unified/20210709.081207 submit/tizen/20210708.031626 submit/tizen_6.5/20211028.162401 tizen_6.5.m2_release
authorHyunsoo Park <hance.park@samsung.com>
Tue, 6 Jul 2021 09:18:01 +0000 (18:18 +0900)
committerHyunsoo Park <hance.park@samsung.com>
Wed, 7 Jul 2021 08:45:26 +0000 (17:45 +0900)
Change-Id: I16df6ee24bff0454db0f06a28a5c640a20e1bd0e
Signed-off-by: Hyunsoo Park <hance.park@samsung.com>
packaging/libmm-streamrecorder.spec
src/mm_streamrecorder_util.c

index 3c0dc89..857a356 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-streamrecorder
 Summary:    Media Stream Recorder library
-Version:    0.0.35
+Version:    0.0.36
 Release:    0
 Group:      Multimedia/Other
 License:    Apache-2.0
index 6666ed5..dd2a782 100644 (file)
@@ -130,7 +130,7 @@ int _mmstreamrecorder_get_pixel_format(GstCaps *caps)
 {
        const GstStructure *structure;
        const char *media_type = NULL;
-       MMPixelFormatType type = 0;
+       MMPixelFormatType type = MM_PIXEL_FORMAT_INVALID;
        unsigned int fourcc = 0;
        GstVideoInfo media_info;
 
@@ -150,9 +150,12 @@ int _mmstreamrecorder_get_pixel_format(GstCaps *caps)
        } else if (!strcmp(media_type, "video/x-raw-yuv")) {
                _mmstreamrec_dbg_log("It is yuv.");
                gst_video_info_init(&media_info);
-               gst_video_info_from_caps(&media_info, caps);
-               fourcc = gst_video_format_to_fourcc(GST_VIDEO_INFO_FORMAT(&media_info));
-               type = _mmstreamrecorder_get_pixtype(fourcc);
+               if (gst_video_info_from_caps(&media_info, caps)) {
+                       fourcc = gst_video_format_to_fourcc(GST_VIDEO_INFO_FORMAT(&media_info));
+                       type = _mmstreamrecorder_get_pixtype(fourcc);
+               } else {
+                       _mmstreamrec_dbg_err("Getting media_info is failed");
+               }
        } else if (!strcmp(media_type, "video/x-raw-rgb")) {
                _mmstreamrec_dbg_log("It is rgb.");
                type = MM_PIXEL_FORMAT_RGB888;
@@ -163,6 +166,7 @@ int _mmstreamrecorder_get_pixel_format(GstCaps *caps)
 
        _mmstreamrec_dbg_log("Type [%d]", type);
 
+error:
        gst_caps_unref(caps);
        caps = NULL;