Correct caps for encoding pipeline 12/292912/1 accepted/tizen/unified/20230605.170354
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 3 May 2023 06:16:41 +0000 (15:16 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 17 May 2023 02:28:51 +0000 (11:28 +0900)
- The resolution of stream could be changed if it's rotated by video filter plugin,
  but it was not considered before.

[Version] 0.10.292
[Issue Type] Bug fix

Change-Id: Iaf2db364f7c75ece2f460ea37b6d7f6835270958
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/libmm-camcorder.spec
src/mm_camcorder_gstcommon.c

index 2022afd..54ebde5 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.291
+Version:    0.10.292
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index cba91d2..1100984 100644 (file)
@@ -1301,32 +1301,32 @@ int _mmcamcorder_create_encodesink_bin(MMHandleType handle, MMCamcorderEncodebin
                MMCAMCORDER_G_OBJECT_SET(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "max-bytes", 0); /* unlimited */
 
                /* set capsfilter */
-               if (profile == MM_CAMCORDER_ENCBIN_PROFILE_VIDEO) {
-                       if (_mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) {
-                               MMCAM_LOG_INFO("get pad from vsrc_c");
-                               pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_CAPS].gst, "src");
-                       } else {
-                               MMCAM_LOG_INFO("get pad from vsrc_q");
-                               pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
-                       }
-                       if (!pad) {
-                               MMCAM_LOG_ERROR("get src pad failed");
-                               err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
-                               goto pipeline_creation_error;
-                       }
-
+               if (sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst) {
+                       MMCAM_LOG_INFO("get pad from vsrc_f");
+                       pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_FILT].gst, "src");
+                       caps_from_pad = gst_pad_get_current_caps(pad);
+               } else if (_mmcamcorder_is_encoded_preview_pixel_format(sc->info_image->preview_format)) {
+                       MMCAM_LOG_INFO("get pad from vsrc_c");
+                       pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_CAPS].gst, "src");
                        caps_from_pad = gst_pad_get_allowed_caps(pad);
-                       video_caps = gst_caps_copy(caps_from_pad);
-                       gst_caps_unref(caps_from_pad);
-                       gst_object_unref(pad);
-
-                       /* fixate caps */
-                       video_caps = gst_caps_fixate(video_caps);
                } else {
-                       /* Image */
-                       MMCAMCORDER_G_OBJECT_GET(sc->element[_MMCAMCORDER_VIDEOSRC_CAPS].gst, "caps", &video_caps);
+                       MMCAM_LOG_INFO("get pad from vsrc_q");
+                       pad = gst_element_get_static_pad(sc->element[_MMCAMCORDER_VIDEOSRC_QUE].gst, "src");
+                       caps_from_pad = gst_pad_get_allowed_caps(pad);
                }
 
+               gst_object_unref(pad);
+
+               if (!caps_from_pad) {
+                       MMCAM_LOG_ERROR("get caps failed");
+                       err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;
+                       goto pipeline_creation_error;
+               }
+
+               video_caps = gst_caps_fixate(gst_caps_copy(caps_from_pad));
+
+               gst_caps_unref(caps_from_pad);
+
                if (!video_caps) {
                        MMCAM_LOG_ERROR("create recording pipeline caps failed");
                        err = MM_ERROR_CAMCORDER_RESOURCE_CREATION;