From: Sangchul Lee Date: Thu, 21 Jul 2022 05:36:57 +0000 (+0900) Subject: webrtc_source: Remove 'Elementary' dependency with a compiling option X-Git-Tag: submit/tizen/20220725.023109~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d6cdf59f91a405b5fe5a54b27d965df480366a1;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_source: Remove 'Elementary' dependency with a compiling option To remove the 'Elementary' dependency, pass an option of gbs build below. --define "without_ui 1" [Version] 0.3.160 [Issue Type] Dependency Change-Id: I8475675970e77017ae58d691ee68bf739d58dad9 Signed-off-by: Sangchul Lee --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e1a3e194..49f4ee87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,12 +12,16 @@ INCLUDE_DIRECTORIES(${INC_DIR}) SET(dependents "dlog glib-2.0 gstreamer-1.0 gstreamer-webrtc-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 \ gstreamer-allocators-1.0 libpulse json-glib-1.0 iniparser mm-common mm-display-interface capi-media-tool \ - libtbm libwebsockets cynara-client libsmack capi-system-info libsoup-2.4 bundle capi-media-sound-manager elementary") + libtbm libwebsockets cynara-client libsmack capi-system-info libsoup-2.4 bundle capi-media-sound-manager") IF(NOT TIZEN_PROFILE_TV) SET(dependents "${dependents} mm-resource-manager") ELSE() ADD_DEFINITIONS("-DTIZEN_TV") ENDIF() +IF(TIZEN_FEATURE_UI) + SET(dependents "${dependents} elementary") + ADD_DEFINITIONS("-DTIZEN_FEATURE_UI") +ENDIF() SET(pc_dependents "capi-base-common capi-media-sound-manager capi-media-tool bundle" ) @@ -40,13 +44,17 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}") AUX_SOURCE_DIRECTORY (src MAIN_SRC) -LIST (APPEND SOURCES +LIST(APPEND SOURCES ${MAIN_SRC} ) IF(TIZEN_PROFILE_TV) - LIST (REMOVE_ITEM SOURCES src/webrtc_resource.c) + LIST(REMOVE_ITEM SOURCES src/webrtc_resource.c) +ENDIF() +IF(NOT TIZEN_FEATURE_UI) + LIST(REMOVE_ITEM SOURCES src/webrtc_source_screen.c) ENDIF() + ADD_LIBRARY(${fw_name} SHARED ${SOURCES}) TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS}) diff --git a/include/webrtc_source_private.h b/include/webrtc_source_private.h index 48a60cc0..7bacbaa2 100644 --- a/include/webrtc_source_private.h +++ b/include/webrtc_source_private.h @@ -79,5 +79,6 @@ GstCaps *_get_caps_from_encoded_video_media_type(const char *media_type, int wid unsigned int _get_available_payload_type(webrtc_s *webrtc); GstCaps *_make_rtp_caps(const gchar *media_type, unsigned int payload_type, webrtc_gst_slot_s *source); int _set_mediapacketsrc_codec_info(webrtc_s *webrtc, webrtc_gst_slot_s *source, media_format_mimetype_e mime_type); +int _get_screen_resolution(int *width, int *height); #endif /* __TIZEN_MEDIA_WEBRTC_SOURCE_COMMON_H__ */ diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index dad4dd69..99c635e8 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.159 +Version: 0.3.160 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -79,9 +79,14 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -DTIZEN_PROFILE_TV=off \ %endif %if "%{test_espp_render}" == "1" --DTIZEN_FEATURE_ESPP=on +-DTIZEN_FEATURE_ESPP=on \ %else --DTIZEN_FEATURE_ESPP=off +-DTIZEN_FEATURE_ESPP=off \ +%endif +%if "%{without_ui}" == "1" +-DTIZEN_FEATURE_UI=off +%else +-DTIZEN_FEATURE_UI=on %endif make %{?jobs:-j%jobs} diff --git a/src/webrtc_internal.c b/src/webrtc_internal.c index e5f1f9ff..9845d644 100644 --- a/src/webrtc_internal.c +++ b/src/webrtc_internal.c @@ -95,7 +95,12 @@ int webrtc_screen_source_set_crop(webrtc_h webrtc, unsigned int source_id, int x locker = g_mutex_locker_new(&_webrtc->mutex); +#ifdef TIZEN_FEATURE_UI return _set_screen_source_crop(_webrtc, source_id, x, y, w, h, portrait_mode, width, height); +#else + LOG_ERROR("TIZEN_FEATURE_UI is disabled, skip this function"); + return WEBRTC_ERROR_INVALID_OPERATION; +#endif } int webrtc_screen_source_unset_crop(webrtc_h webrtc, unsigned int source_id) @@ -109,7 +114,12 @@ int webrtc_screen_source_unset_crop(webrtc_h webrtc, unsigned int source_id) locker = g_mutex_locker_new(&_webrtc->mutex); +#ifdef TIZEN_FEATURE_UI return _unset_screen_source_crop(_webrtc, source_id); +#else + LOG_ERROR("TIZEN_FEATURE_UI is disabled, skip this function"); + return WEBRTC_ERROR_INVALID_OPERATION; +#endif } int webrtc_set_rtp_packet_drop_probability(webrtc_h webrtc, bool sender, float probability) diff --git a/src/webrtc_source.c b/src/webrtc_source.c index 0d59ff78..ecb78ed7 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -22,7 +22,6 @@ #include "webrtc_source_private.h" #include -#include #include #define MIN_DYNAMIC_PAYLOAD_TYPE 96 @@ -602,28 +601,22 @@ static bool __set_default_video_info(webrtc_gst_slot_s *source, const ini_item_m source->video_info.height = ini_source->v_height; if (source->type == WEBRTC_MEDIA_SOURCE_TYPE_SCREEN) { - Evas_Object *eo = NULL; +#ifdef TIZEN_FEATURE_UI int width = 0; int height = 0; - eo = elm_win_add(NULL, "screen_source", ELM_WIN_BASIC); - if (!eo) { - LOG_WARNING("failed to add window to get screen size. use values of ini"); - return true; - } - - elm_win_screen_size_get(eo, NULL, NULL, &width, &height); - LOG_DEBUG("window size: %d x %d", width, height); - - if (width == 0 || height == 0) { - LOG_WARNING("failed to get screen size. use values of ini"); - return true; + if (_get_screen_resolution(&width, &height) != WEBRTC_ERROR_NONE) { + if (width == 0 || height == 0) { + LOG_WARNING("failed to _get_screen_resolution(). use values of ini"); + return true; + } } - source->video_info.width = width; source->video_info.height = height; +#else + LOG_WARNING("TIZEN_FEATURE_UI is disabled, skip this function, use values of ini"); +#endif } - return true; } @@ -2216,6 +2209,12 @@ int _add_media_source(webrtc_s *webrtc, int type, unsigned int *source_id) if (type == WEBRTC_MEDIA_SOURCE_TYPE_NULL) return __add_null_source(webrtc, source_id); +#ifndef TIZEN_FEATURE_UI + if (type == WEBRTC_MEDIA_SOURCE_TYPE_SCREEN) { + LOG_ERROR("TIZEN_FEATURE_UI is disabled, screen source is not supported"); + return WEBRTC_ERROR_INVALID_OPERATION; + } +#endif return __add_media_source(webrtc, type, source_id); } diff --git a/src/webrtc_source_screen.c b/src/webrtc_source_screen.c index b8a7b530..8e438994 100644 --- a/src/webrtc_source_screen.c +++ b/src/webrtc_source_screen.c @@ -16,6 +16,7 @@ #include "webrtc_private.h" #include "webrtc_source_private.h" +#include //LCOV_EXCL_START int _set_screen_source_crop(webrtc_s *webrtc, unsigned int source_id, int x, int y, int w, int h, bool portrait_mode, int *width, int *height) @@ -120,4 +121,28 @@ int _unset_screen_source_crop(webrtc_s *webrtc, unsigned int source_id) return WEBRTC_ERROR_NONE; } +int _get_screen_resolution(int *width, int *height) +{ + Evas_Object *eo; + int _width; + int _height; + + RET_VAL_IF(width == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "width is NULL"); + RET_VAL_IF(height == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "height is NULL"); + + eo = elm_win_add(NULL, "screen_source", ELM_WIN_BASIC); + if (!eo) { + LOG_ERROR("failed to elm_win_add()"); + return WEBRTC_ERROR_INVALID_OPERATION; + } + + elm_win_screen_size_get(eo, NULL, NULL, &_width, &_height); + LOG_DEBUG("window size: %d x %d", _width, _height); + + *width = _width; + *height = _height; + + return WEBRTC_ERROR_NONE; +} + //LCOV_EXCL_STOP \ No newline at end of file