Apply restriction for use of WEBRTC_MEDIA_SOURCE_TYPE_SCREEN 42/281742/2
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 21 Sep 2022 08:38:00 +0000 (17:38 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 23 Sep 2022 00:02:28 +0000 (09:02 +0900)
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 <sc11.lee@samsung.com>
include/webrtc.h
packaging/capi-media-webrtc.spec
src/webrtc.c
src/webrtc_source.c

index 6fe68050994e457d5cad5958b048ad70dd89539d..6c32c8c775582d2549e41233e145c4862b02d1af 100644 (file)
@@ -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
index 3f19954d80b71443e1f30129672bbde90f425dfe..1f142c420b50665c11c03bd82bc712b5b4960ea1 100644 (file)
@@ -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
index e9398f00e4d75bf1d99c3405f3d1a429309d16cb..145b4b5926e03849938b81b516ca01f52c8d6c91 100644 (file)
@@ -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");
index 6d568ae549d7154bf33dda3623f338e2d51d3573..d6903b386c4f4635343845d1458dd73f5566f2d9 100644 (file)
@@ -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);