diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2017-03-13 11:11:18 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2017-03-13 11:11:18 +0900 |
commit | 0f34696eeb86de03e35ae371d261bceb32d64aea (patch) | |
tree | 76d044e10a8c2be48ec7fec7ddcee1c43e5c3345 | |
parent | cef216144ce284b41eb4d0adda31a8f5e185f249 (diff) | |
download | camera-accepted/tizen_3.0_mobile.tar.gz camera-accepted/tizen_3.0_mobile.tar.bz2 camera-accepted/tizen_3.0_mobile.zip |
Return buffer in case of NULL callback from usersubmit/tizen_3.0/20170317.034449accepted/tizen/3.0/wearable/20170320.080057accepted/tizen/3.0/tv/20170320.075724accepted/tizen/3.0/mobile/20170320.074624accepted/tizen/3.0/ivi/20170320.080307accepted/tizen/3.0/common/20170320.130311accepted/tizen_3.0_wearableaccepted/tizen_3.0_tvaccepted/tizen_3.0_mobileaccepted/tizen_3.0_iviaccepted/tizen_3.0_common
user's callback could be NULL while preview callback is running.
Add exception code for it.
[Version] 0.2.99
[Profile] Common
[Issue Type] Bug fix
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20170302.1]
Change-Id: I64b98241a728cc523c7518140d01df77c716ce62
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | src/camera.c | 78 |
2 files changed, 52 insertions, 28 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 9996ab1..7df9e0e 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,6 +1,6 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.2.98 +Version: 0.2.99 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index 9ce9616..7d50534 100644 --- a/src/camera.c +++ b/src/camera.c @@ -1097,7 +1097,16 @@ static void _camera_client_user_callback(camera_cb_info_s *cb_info, char *recv_m if (!(CHECK_PREVIEW_CB(cb_info, PREVIEW_CB_TYPE_EVAS)) && cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] == NULL && cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] == NULL) { - LOGW("all preview callback from user are NULL"); + /* return preview callback */ + _camera_msg_send(MUSE_CAMERA_API_PREVIEW_CB_RETURN, cb_info, NULL, 0); + + /* return buffer */ + muse_camera_msg_get(tbm_key, recv_msg); + LOGW("all preview callback from user are NULL - return key %d", tbm_key); + if (tbm_key > 0) { + CAMERA_MSG_PARAM_SET(param, INT, tbm_key); + _camera_msg_send_param1(MUSE_CAMERA_API_RETURN_BUFFER, cb_info, NULL, ¶m, 0); + } return; } } else if (cb_info->user_cb[event] == NULL) { @@ -3796,13 +3805,14 @@ int camera_unset_preview_cb(camera_h camera) LOGD("Enter"); - pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = NULL; - pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = NULL; - - UNSET_PREVIEW_CB_TYPE(pc->cb_info, PREVIEW_CB_TYPE_USER); - _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = NULL; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_PREVIEW] = NULL; + UNSET_PREVIEW_CB_TYPE(pc->cb_info, PREVIEW_CB_TYPE_USER); + } + LOGD("ret : 0x%x", ret); return ret; @@ -3858,11 +3868,13 @@ int camera_unset_media_packet_preview_cb(camera_h camera) LOGD("Enter"); - pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = NULL; - pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = NULL; - _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = NULL; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_MEDIA_PACKET_PREVIEW] = NULL; + } + LOGD("ret : 0x%x", ret); return ret; @@ -3908,11 +3920,13 @@ int camera_unset_state_changed_cb(camera_h camera) LOGD("Enter"); - pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = NULL; - pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = NULL; - _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = NULL; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_STATE_CHANGE] = NULL; + } + LOGD("ret : 0x%x", ret); return ret; @@ -3958,11 +3972,13 @@ int camera_unset_interrupted_cb(camera_h camera) LOGD("Enter"); - pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = NULL; - pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = NULL; - _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = NULL; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_INTERRUPTED] = NULL; + } + LOGD("ret : 0x%x", ret); return ret; @@ -4008,11 +4024,13 @@ int camera_unset_focus_changed_cb(camera_h camera) LOGD("Enter"); - pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = NULL; - pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = NULL; - _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = NULL; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_FOCUS_CHANGE] = NULL; + } + LOGD("ret : 0x%x", ret); return ret; @@ -4058,11 +4076,13 @@ int camera_unset_error_cb(camera_h camera) LOGD("Enter"); - pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = NULL; - pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = NULL; - _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_ERROR] = NULL; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_ERROR] = NULL; + } + LOGD("ret : 0x%x", ret); return ret; @@ -5950,11 +5970,13 @@ int camera_attr_set_hdr_capture_progress_cb(camera_h camera, camera_attr_hdr_pro return CAMERA_ERROR_INVALID_PARAMETER; } - pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback; - pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data; - _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = callback; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = user_data; + } + LOGD("ret : 0x%x", ret); return ret; @@ -5974,11 +5996,13 @@ int camera_attr_unset_hdr_capture_progress_cb(camera_h camera) LOGD("Enter"); - pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = NULL; - pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = NULL; - _camera_msg_send(api, pc->cb_info, &ret, CAMERA_CB_TIMEOUT); + if (ret == CAMERA_ERROR_NONE) { + pc->cb_info->user_cb[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = NULL; + pc->cb_info->user_data[MUSE_CAMERA_EVENT_TYPE_HDR_PROGRESS] = NULL; + } + LOGD("ret : 0x%x", ret); return ret; |