webrtc_source: Set source element properties values from ini file 17/267517/2 accepted/tizen/unified/20211209.140549 submit/tizen/20211208.120003
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 6 Dec 2021 11:46:30 +0000 (20:46 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 7 Dec 2021 09:33:45 +0000 (18:33 +0900)
[Version] 0.3.14
[Issue Type] Improvement

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

index 7f4868bd6b3d7892ee0ed6309b5920be0c56079c..92b29d77072bedafb21b8a258f53ef2a9ca108ed 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.13
+Version:    0.3.14
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index ff3501cf4f14f4b054fd1d8235884933a43c96ba..860b257ee26c438f7eceb7cae4cb1cc51c2cbddd 100644 (file)
@@ -1307,6 +1307,7 @@ static int __build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GList *switch_src_list = NULL;
        GList *element_list = NULL;
        GstPad *src_pad;
+       ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1322,6 +1323,12 @@ static int __build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
                return WEBRTC_ERROR_INVALID_OPERATION;
        APPEND_ELEMENT(switch_src_list, screensrc);
 
+       if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
+               LOG_ERROR("ini_source is NULL");
+               goto exit;
+       }
+       _gst_set_element_properties(screensrc, ini_source->source_element_properties);
+
        if (!(videotestsrc = _create_element(DEFAULT_ELEMENT_VIDEOTESTSRC, ELEMENT_NAME_VIDEO_MUTE_SRC)))
                goto exit;
        APPEND_ELEMENT(switch_src_list, videotestsrc);
@@ -1400,6 +1407,7 @@ static int __build_camerasrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
+       ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1418,7 +1426,11 @@ static int __build_camerasrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
                return WEBRTC_ERROR_INVALID_OPERATION;
        APPEND_ELEMENT(element_list, camerasrc);
 
-       /* FIXME: set camera default setting from ini */
+       if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
+               LOG_ERROR("ini_source is NULL");
+               goto exit;
+       }
+       _gst_set_element_properties(camerasrc, ini_source->source_element_properties);
 
        /* NOTE: in case of an element that supports tizen zerocopy format, not to emit an error in GST_STATE_PLAYING
         * without buffer consumption before finishing negotiation, set this property to 0 here. */
@@ -1470,6 +1482,7 @@ static int __build_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source, bool us
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
+       ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1486,8 +1499,11 @@ static int __build_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source, bool us
                return WEBRTC_ERROR_INVALID_OPERATION;
        APPEND_ELEMENT(element_list, audiosrc);
 
-       if (!use_mic)
-               g_object_set(G_OBJECT(audiosrc), "is-live", TRUE, NULL);
+       if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
+               LOG_ERROR("ini_source is NULL");
+               goto exit;
+       }
+       _gst_set_element_properties(audiosrc, ini_source->source_element_properties);
 
        if (!(volume = _create_element(DEFAULT_ELEMENT_VOLUME, ELEMENT_NAME_VOLUME)))
                goto exit;
@@ -1536,6 +1552,7 @@ static int __build_videotestsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
+       ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1551,10 +1568,11 @@ static int __build_videotestsrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
                return WEBRTC_ERROR_INVALID_OPERATION;
        APPEND_ELEMENT(element_list, videotestsrc);
 
-       g_object_set(G_OBJECT(videotestsrc),
-               "is-live", TRUE,
-               "pattern", 18, /* ball */
-               NULL);
+       if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
+               LOG_ERROR("ini_source is NULL");
+               goto exit;
+       }
+       _gst_set_element_properties(videotestsrc, ini_source->source_element_properties);
 
        if ((ret = __create_rest_of_elements(webrtc, source, true, &element_list, false)) != WEBRTC_ERROR_NONE)
                goto exit;
@@ -1600,6 +1618,7 @@ static int __build_custom_videosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
+       ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1615,6 +1634,12 @@ static int __build_custom_videosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
                return WEBRTC_ERROR_INVALID_OPERATION;
        APPEND_ELEMENT(element_list, custom_videosrc);
 
+       if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
+               LOG_ERROR("ini_source is NULL");
+               goto exit;
+       }
+       _gst_set_element_properties(custom_videosrc, ini_source->source_element_properties);
+
        if ((ret = __create_rest_of_elements(webrtc, source, true, &element_list, false)) != WEBRTC_ERROR_NONE)
                goto exit;
 
@@ -1660,6 +1685,7 @@ static int __build_custom_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
        GstElement *capsfilter;
        GList *element_list = NULL;
        GstPad *src_pad;
+       ini_item_media_source_s *ini_source;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
@@ -1676,6 +1702,12 @@ static int __build_custom_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
                return WEBRTC_ERROR_INVALID_OPERATION;
        APPEND_ELEMENT(element_list, custom_audiosrc);
 
+       if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
+               LOG_ERROR("ini_source is NULL");
+               goto exit;
+       }
+       _gst_set_element_properties(custom_audiosrc, ini_source->source_element_properties);
+
        if (!(volume = _create_element(DEFAULT_ELEMENT_VOLUME, ELEMENT_NAME_VOLUME)))
                goto exit;
        APPEND_ELEMENT(element_list, volume);