From: Sangchul Lee Date: Thu, 4 Jan 2024 03:27:02 +0000 (+0900) Subject: Adjust order of returning error values X-Git-Tag: accepted/tizen/8.0/unified/20240105.165238^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8050ea282c7934cd2b4c37482c476e64b8e2c55e;p=platform%2Fcore%2Fapi%2Fwebrtc.git Adjust order of returning error values The order of errors for particular functions were not in compliance with the following sequence. - NOT_SUPPORTED > PERMISSION_DENIED > INVALID_PARAMETER [Version] 0.4.30 [Issue Type] Improvement Change-Id: I816ce028bc31abb601871538ea57db96f1ee4110 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 7aada97d..11c130ef 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.4.29 +Version: 0.4.30 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index 221d06fd..3d33fba7 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -742,6 +742,7 @@ int webrtc_screen_source_set_crop(webrtc_h webrtc, unsigned int source_id, int x g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; + RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_PLATFORM); RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0"); RET_VAL_IF(x < 0, WEBRTC_ERROR_INVALID_PARAMETER, "x < 0"); @@ -752,7 +753,6 @@ int webrtc_screen_source_set_crop(webrtc_h webrtc, unsigned int source_id, int x locker = g_mutex_locker_new(&_webrtc->mutex); RET_VAL_IF(_webrtc->state == WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should not be IDLE"); - RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_PLATFORM); #ifdef TIZEN_FEATURE_UI return _set_screen_source_crop(_webrtc, source_id, x, y, width, height); @@ -767,13 +767,13 @@ int webrtc_screen_source_unset_crop(webrtc_h webrtc, unsigned int source_id) g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; + RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_PLATFORM); RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0"); locker = g_mutex_locker_new(&_webrtc->mutex); RET_VAL_IF(_webrtc->state == WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should not be IDLE"); - RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_PLATFORM); #ifdef TIZEN_FEATURE_UI return _unset_screen_source_crop(_webrtc, source_id); diff --git a/src/webrtc_internal.c b/src/webrtc_internal.c index 9d80bf5c..e3febaed 100644 --- a/src/webrtc_internal.c +++ b/src/webrtc_internal.c @@ -95,6 +95,7 @@ int webrtc_get_video_resolution(webrtc_h webrtc, unsigned int track_id, int *wid int webrtc_take_snapshot(webrtc_h webrtc, unsigned int track_id, webrtc_snapshot_format_e format, int option, webrtc_snapshot_cb callback, void *user_data) { +#ifdef TIZEN_FEATURE_SNAPSHOT g_autoptr(GMutexLocker) locker = NULL; webrtc_s *_webrtc = (webrtc_s *)webrtc; @@ -104,9 +105,9 @@ int webrtc_take_snapshot(webrtc_h webrtc, unsigned int track_id, webrtc_snapshot locker = g_mutex_locker_new(&_webrtc->mutex); RET_VAL_IF(_webrtc->track_added_cb.callback == NULL, WEBRTC_ERROR_INVALID_OPERATION, "track added callback was not set"); -#ifdef TIZEN_FEATURE_SNAPSHOT return _capture_video_frame_from_sink(_webrtc, track_id, format, option, callback, user_data); #else + LOG_ERROR("not supported function"); return WEBRTC_ERROR_NOT_SUPPORTED; #endif }