diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2016-01-06 19:14:50 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2016-01-06 19:57:05 +0900 |
commit | 46d82b93e8778160a8970c2052e3d5d6443fb956 (patch) | |
tree | 712b8224bfdb25d213cbe09847808eec20d6ec36 | |
parent | 58a0601b48af1ab055341ce9b463fce2676a8de0 (diff) | |
download | camera-46d82b93e8778160a8970c2052e3d5d6443fb956.tar.gz camera-46d82b93e8778160a8970c2052e3d5d6443fb956.tar.bz2 camera-46d82b93e8778160a8970c2052e3d5d6443fb956.zip |
[Release version 0.2.35] Fix bug - 1. fd leak, 2. does not stop foreach callback even though callback returns falsesubmit/tizen/20160106.112016accepted/tizen/wearable/20160107.101227accepted/tizen/tv/20160107.101211accepted/tizen/mobile/20160107.101154
Change-Id: I9b181a8dc72409eaabb309b8f2f556fbcf0cdf94
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | src/camera.c | 101 |
2 files changed, 86 insertions, 17 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index bbe34e4..c7cb1a8 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -3,7 +3,7 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.2.34 +Version: 0.2.35 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index ea7b6cb..702ec1c 100644 --- a/src/camera.c +++ b/src/camera.c @@ -917,7 +917,11 @@ static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, mus LOGD("SUPPORTED_PREVIEW_RESOLUTION - %d x %d", param1, param2); - ((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]); + if (((camera_supported_preview_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_PREVIEW_RESOLUTION"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_RESOLUTION: muse_camera_msg_get(param1, recv_msg); @@ -925,105 +929,165 @@ static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, mus LOGD("SUPPORTED_CAPTURE_RESOLUTION - %d x %d", param1, param2); - ((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]); + if (((camera_supported_capture_resolution_cb)cb_info->user_cb[event])(param1, param2, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_CAPTURE_RESOLUTION"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_CAPTURE_FORMAT: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_CAPTURE_FORMAT - %d ", param1); - ((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]); + if (((camera_supported_capture_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_CAPTURE_FORMAT"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_PREVIEW_FORMAT: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_PREVIEW_FORMAT - %d ", param1); - ((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]); + if (((camera_supported_preview_format_cb)cb_info->user_cb[event])((camera_pixel_format_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_PREVIEW_FORMAT"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_AF_MODE: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_AF_MODE - %d ", param1); - ((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_af_mode_cb)cb_info->user_cb[event])((camera_attr_af_mode_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_AF_MODE"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EXPOSURE_MODE: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_EXPOSURE_MODE - %d ", param1); - ((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_exposure_mode_cb)cb_info->user_cb[event])((camera_attr_exposure_mode_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_EXPOSURE_MODE"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_ISO: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_ISO - %d ", param1); - ((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_iso_cb)cb_info->user_cb[event])((camera_attr_iso_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_ISO"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_WHITEBALANCE: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_WHITEBALANCE - %d ", param1); - ((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_whitebalance_cb)cb_info->user_cb[event])((camera_attr_whitebalance_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_WHITEBALANCE"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_EFFECT: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_EFFECT - %d ", param1); - ((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_effect_cb)cb_info->user_cb[event])((camera_attr_effect_mode_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_EFFECT"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_SCENE_MODE: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_SCENE_MODE - %d ", param1); - ((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_scene_mode_cb)cb_info->user_cb[event])((camera_attr_scene_mode_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_SCENE_MODE"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FLASH_MODE: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_FLASH_MODE - %d ", param1); - ((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_flash_mode_cb)cb_info->user_cb[event])((camera_attr_flash_mode_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_FLASH_MODE"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_FPS - %d ", param1); - ((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_FPS"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_FPS_BY_RESOLUTION: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_FPS_BY_RESOLUTION - %d ", param1); - ((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_fps_cb)cb_info->user_cb[event])((camera_attr_fps_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_FPS_BY_RESOLUTION"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_FLIP: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_STREAM_FLIP - %d ", param1); - ((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_stream_flip_cb)cb_info->user_cb[event])((camera_flip_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_STREAM_FLIP"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_STREAM_ROTATION: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_STREAM_ROTATION - %d ", param1); - ((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_stream_rotation_cb)cb_info->user_cb[event])((camera_rotation_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_STREAM_ROTATION"); + } break; case MUSE_CAMERA_EVENT_TYPE_FOREACH_SUPPORTED_THEATER_MODE: muse_camera_msg_get(param1, recv_msg); LOGD("SUPPORTED_THEATER_MODE - %d ", param1); - ((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]); + if (((camera_attr_supported_theater_mode_cb)cb_info->user_cb[event])((camera_attr_theater_mode_e)param1, cb_info->user_data[event]) == false) { + cb_info->user_cb[event] = NULL; + cb_info->user_data[event] = NULL; + LOGD("stop foreach callback for SUPPORTED_THEATER_MODE"); + } break; case MUSE_CAMERA_EVENT_TYPE_CAPTURE: { @@ -1638,6 +1702,11 @@ static void _client_callback_destroy(camera_cb_info_s *cb_info) LOGD("event thread removed"); + if (cb_info->fd > -1) { + muse_core_connection_close(cb_info->fd); + cb_info->fd = -1; + } + if (cb_info->bufmgr) { tbm_bufmgr_deinit(cb_info->bufmgr); cb_info->bufmgr = NULL; |