From: Sangchul Lee Date: Thu, 28 Jan 2021 09:44:10 +0000 (+0900) Subject: Apply camera/microphone feature to webrtc_add_media_source() API X-Git-Tag: submit/tizen/20210729.023123~143 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b275e84d9380cc7a25be3f06e14c1e89193b76b3;p=platform%2Fcore%2Fapi%2Fwebrtc.git Apply camera/microphone feature to webrtc_add_media_source() API 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 --- diff --git a/include/webrtc.h b/include/webrtc.h index fd57627d..5b87bb95 100644 --- a/include/webrtc.h +++ b/include/webrtc.h @@ -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 diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 10fd2821..52bd1509 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.97 +Version: 0.1.98 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index 8b7607bf..7336adc8 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -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);