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-15 15:19:51 +0900 |
commit | f5af3fddfafb3d2607662fbfa7f9aa4b59079188 (patch) | |
tree | 76d044e10a8c2be48ec7fec7ddcee1c43e5c3345 /src | |
parent | 2446451028e14123afb18cd58f16f43098f394c6 (diff) | |
download | camera-f5af3fddfafb3d2607662fbfa7f9aa4b59079188.tar.gz camera-f5af3fddfafb3d2607662fbfa7f9aa4b59079188.tar.bz2 camera-f5af3fddfafb3d2607662fbfa7f9aa4b59079188.zip |
Return buffer in case of NULL callback from user
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/camera.c | 78 |
1 files changed, 51 insertions, 27 deletions
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; |