From: Sangchul Lee Date: Thu, 28 Jan 2021 09:09:10 +0000 (+0900) Subject: webrtc_restriction: Add function to check feature X-Git-Tag: submit/tizen/20210729.023123~144 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45be63f8dd23f5906e01473679c43a29e1e2884e;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_restriction: Add function to check feature RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED macro is also added in webrtc_private.h. [Version] 0.1.97 [Issue Type] Feature Change-Id: I6b154da971830d2392fe691370fe88ec88afddfc Signed-off-by: Sangchul Lee --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c1f7afa6..0e4e0c09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ 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 \ json-glib-1.0 iniparser mm-common mm-display-interface capi-media-tool libtbm libwebsockets \ - cynara-client libsmack libsoup-2.4") + cynara-client libsmack capi-system-info libsoup-2.4") IF(TIZEN_FEATURE_RESOURCE_MANAGER) SET(dependents "${dependents} mm-resource-manager") ADD_DEFINITIONS("-DTIZEN_FEATURE_RES_MGR") diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 73edd2e7..098fe607 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -128,6 +128,13 @@ do { \ return ret; \ } while (0) +#define RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(x_feature) \ +do { \ + int ret = _check_feature(x_feature); \ + if (ret != WEBRTC_ERROR_NONE) \ + return ret; \ +} while (0) + #define SAFE_FREE(src) { if (src) { free(src); src = NULL; } } #define SAFE_STR(str) (str) ? str : "null" @@ -466,6 +473,7 @@ int _start_websocket(webrtc_websocket_s *ws, int timeout_ms); int _stop_websocket(webrtc_websocket_s *ws); int _check_privilege(const char *privilege); +int _check_feature(const char *feature); #ifdef __cplusplus } diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 3468e172..10fd2821 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.1.96 +Version: 0.1.97 Release: 0 Group: Multimedia/API License: Apache-2.0 @@ -27,6 +27,7 @@ BuildRequires: pkgconfig(libtbm) BuildRequires: pkgconfig(libwebsockets) BuildRequires: pkgconfig(cynara-client) BuildRequires: pkgconfig(libsmack) +BuildRequires: pkgconfig(capi-system-info) %if "%{tizen_profile_name}" != "tv" BuildRequires: pkgconfig(mm-resource-manager) %endif diff --git a/src/webrtc_restriction.c b/src/webrtc_restriction.c index fad54ed1..a37f6203 100644 --- a/src/webrtc_restriction.c +++ b/src/webrtc_restriction.c @@ -18,6 +18,7 @@ #include "webrtc_private.h" #include #include +#include int _check_privilege(const char *privilege) { @@ -49,3 +50,24 @@ exit: cynara_finish(cynara_h); return ret; } + +int _check_feature(const char *feature) +{ + bool supported; + + RET_VAL_IF(feature == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "feature is NULL"); + + if (system_info_get_platform_bool(feature, &supported) != SYSTEM_INFO_ERROR_NONE) { + LOG_ERROR("failed to system_info_get_platform_bool(), feature[%s]", feature); + return WEBRTC_ERROR_INVALID_OPERATION; + } + + if (!supported) { + LOG_ERROR("feature[%s] is not supported", feature); + return WEBRTC_ERROR_NOT_SUPPORTED; + } + + LOG_INFO("feature[%s] is supported", feature); + + return WEBRTC_ERROR_NONE; +}