Apply camera/microphone feature to webrtc_add_media_source() API 97/252497/4
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 28 Jan 2021 09:44:10 +0000 (18:44 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 2 Feb 2021 06:47:08 +0000 (15:47 +0900)
For WEBRTC_MEDIA_SOURCE_TYPE_CAMERA type
  feature: http://tizen.org/feature/camera

For WEBRTC_MEDIA_SOURCE_TYPE_MIC type
  feature: http://tizen.org/feature/microphone

[Version] 0.1.98
[Issue Type] Feature

Change-Id: Ife9d500d3c2ee743aa133a21134105429f5f0c61
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc.h
packaging/capi-media-webrtc.spec
src/webrtc.c

index fd57627db98b02eb70bad1fbc2651a9fa7e2fd90..5b87bb9522c19842fd6f0a0dab1b03ee2f82e268 100644 (file)
@@ -459,6 +459,7 @@ int webrtc_get_state(webrtc_h webrtc, webrtc_state_e *state);
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #WEBRTC_ERROR_NONE    Successful
+ * @retval #WEBRTC_ERROR_NOT_SUPPORTED Not supported
  * @retval #WEBRTC_ERROR_PERMISSION_DENIED Permission denied
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
index 10fd28218028060eb6003a86e43f2f75b5908db5..52bd1509ac4dd760387defea6a31213e317f4998 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.1.97
+Version:    0.1.98
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 8b7607bfb5f41fcb5f9c545a2ff19d9a8c1556eb..7336adc85b4904fbb3a81a29ed9acad07aab46ea 100644 (file)
@@ -21,6 +21,8 @@
 #include "webrtc.h"
 #include "webrtc_private.h"
 
+#define _WEBRTC_FEATURE_CAMERA        "http://tizen.org/feature/camera"
+#define _WEBRTC_FEATURE_MICROPHONE    "http://tizen.org/feature/microphone"
 #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"
@@ -243,13 +245,16 @@ int webrtc_add_media_source(webrtc_h webrtc, webrtc_media_source_type_e type, un
        int ret = WEBRTC_ERROR_NONE;
        webrtc_s *_webrtc = (webrtc_s*)webrtc;
 
-       RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
-       RET_VAL_IF(source_id == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is NULL");
-
-       if (type == WEBRTC_MEDIA_SOURCE_TYPE_CAMERA)
+       if (type == WEBRTC_MEDIA_SOURCE_TYPE_CAMERA) {
+               RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(_WEBRTC_FEATURE_CAMERA);
                RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_CAMERA);
-       else if (type == WEBRTC_MEDIA_SOURCE_TYPE_MIC)
+       } 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);
+       }
+
+       RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+       RET_VAL_IF(source_id == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is NULL");
 
        g_mutex_lock(&_webrtc->mutex);