From: Sangchul Lee Date: Wed, 21 Sep 2022 08:38:00 +0000 (+0900) Subject: Apply restriction for use of WEBRTC_MEDIA_SOURCE_TYPE_SCREEN X-Git-Tag: accepted/tizen/unified/20220927.132346~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=badb1c313d22ffd5b79ce05d352e532964728e1f;p=platform%2Fcore%2Fapi%2Fwebrtc.git Apply restriction for use of WEBRTC_MEDIA_SOURCE_TYPE_SCREEN Locations of macro to exclude lines from coverage measurement are also modified. [Version] 0.3.245 [Issue Type] API Change-Id: Ibbe0bf8a32f2c61b3734690cbe9068809d88349d Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc.h b/include/webrtc.h index 6fe68050..6c32c8c7 100644 --- a/include/webrtc.h +++ b/include/webrtc.h @@ -1016,7 +1016,8 @@ int webrtc_get_state(webrtc_h webrtc, webrtc_state_e *state); * @since_tizen 6.5 * @remarks The camera privilege(%http://tizen.org/privilege/camera) should be added if @a type is #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA.\n * The recorder privilege(%http://tizen.org/privilege/recorder) should be added if @a type is #WEBRTC_MEDIA_SOURCE_TYPE_MIC.\n - * With @a type of #WEBRTC_MEDIA_SOURCE_TYPE_NULL, you can configure a transceiver only for receiving audio or video stream. (Since 7.0) + * With @a type of #WEBRTC_MEDIA_SOURCE_TYPE_NULL, you can configure a transceiver only for receiving audio or video stream. (Since 7.0)\n + * @a type of #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN is not allowed to be used by third-party applications due to the security reasons. (Since 7.0) * @param[in] webrtc WebRTC handle * @param[in] type The media source type to be added * @param[out] source_id The media source id diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 3f19954d..1f142c42 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.244 +Version: 0.3.245 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index e9398f00..145b4b59 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -26,6 +26,7 @@ #define _WEBRTC_PRIVILEGE_INTERNET "http://tizen.org/privilege/internet" #define _WEBRTC_PRIVILEGE_CAMERA "http://tizen.org/privilege/camera" #define _WEBRTC_PRIVILEGE_RECORDER "http://tizen.org/privilege/recorder" +#define _WEBRTC_PRIVILEGE_PLATFORM "http://tizen.org/privilege/internal/default/platform" typedef struct { const char *str; @@ -299,6 +300,8 @@ int webrtc_add_media_source(webrtc_h webrtc, webrtc_media_source_type_e type, un } else if (type == WEBRTC_MEDIA_SOURCE_TYPE_MIC) { RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_MICROPHONE); RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_RECORDER); + } else if (type == WEBRTC_MEDIA_SOURCE_TYPE_SCREEN) { + RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_PLATFORM); } RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); diff --git a/src/webrtc_source.c b/src/webrtc_source.c index 6d568ae5..d6903b38 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -53,6 +53,7 @@ static GstCaps *__make_video_raw_caps_with_framerate(webrtc_gst_slot_s *source, return caps; } +//LCOV_EXCL_START static bool __link_switch_srcs(GstElement *switch_element, GList *switch_src_list) { GstElement *element; @@ -71,6 +72,7 @@ static bool __link_switch_srcs(GstElement *switch_element, GList *switch_src_lis return true; } +//LCOV_EXCL_STOP static bool __set_default_video_info(webrtc_gst_slot_s *source, const ini_item_media_source_s *ini_source) { @@ -119,6 +121,7 @@ static int __build_src_check_params_and_get_ini_source(webrtc_s *webrtc, webrtc_ return WEBRTC_ERROR_NONE; } +//LCOV_EXCL_START static int __build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source) { int ret; @@ -192,7 +195,6 @@ exit: return WEBRTC_ERROR_INVALID_OPERATION; } -//LCOV_EXCL_START static int __mute_by_changing_property(webrtc_gst_slot_s *source, GstElement *videotestsrc, bool mute) { RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL"); @@ -651,10 +653,10 @@ static int __build_source_bin(webrtc_s *webrtc, webrtc_gst_slot_s *source) case WEBRTC_MEDIA_SOURCE_TYPE_CAMERA: return __build_camerasrc(webrtc, source); - +//LCOV_EXCL_START case WEBRTC_MEDIA_SOURCE_TYPE_SCREEN: return __build_screensrc(webrtc, source); - +//LCOV_EXCL_STOP case WEBRTC_MEDIA_SOURCE_TYPE_FILE: return _build_filesrc_pipeline(webrtc, source);