/**
* @brief Adds a media source.
* @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.
* @param[in] webrtc WebRTC handle
* @param[in] type The media source type to be added
* @param[out] source_id The media source id
* @return @c 0 on success,
* otherwise a negative error value
* @retval #WEBRTC_ERROR_NONE Successful
+ * @retval #WEBRTC_ERROR_PERMISSION_DENIED Permission denied
* @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
* @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
#include "webrtc_private.h"
#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"
int webrtc_set_error_cb(webrtc_h webrtc, webrtc_error_cb callback, void *user_data)
{
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)
+ RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_CAMERA);
+ else if (type == WEBRTC_MEDIA_SOURCE_TYPE_MIC)
+ RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_RECORDER);
+
g_mutex_lock(&_webrtc->mutex);
RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be IDLE");