From: Sangchul Lee Date: Mon, 6 Dec 2021 11:46:30 +0000 (+0900) Subject: webrtc_source: Set source element properties values from ini file X-Git-Tag: submit/tizen/20211208.120003^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad279b6ce31c8e62dc239373218f494fb1ea8344;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_source: Set source element properties values from ini file [Version] 0.3.14 [Issue Type] Improvement Change-Id: I3367d1d8ae0f5b20be644330a3131c9906edcefd Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 7f4868bd..92b29d77 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.3.13 +Version: 0.3.14 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source.c b/src/webrtc_source.c index ff3501cf..860b257e 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -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);