Adjust order of returning error values 84/303784/1 accepted/tizen/8.0/unified/20240105.165238
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 4 Jan 2024 03:27:02 +0000 (12:27 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 5 Jan 2024 01:10:32 +0000 (01:10 +0000)
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 <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc.c
src/webrtc_internal.c

index 7aada97d9d087e594614222f74fada0061ebeafd..11c130efcc6eb6b70f0239086ff95791b0fbea9a 100644 (file)
@@ -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
index 221d06fde0b75798a2d4580516205386246023f0..3d33fba749c9afdbf4bff082e00ea0c1d11904b3 100644 (file)
@@ -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);
index 9d80bf5cf38f8f38a2eee11ccb7bff5c352549d6..e3febaedd6c0cf84688d420853f5b28947dd9e39 100644 (file)
@@ -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
 }