diff options
author | Jeongmo Yang <jm80.yang@samsung.com> | 2017-02-09 16:18:38 +0900 |
---|---|---|
committer | Jeongmo Yang <jm80.yang@samsung.com> | 2017-02-15 17:40:43 +0900 |
commit | 0b21bf58d7eb232bf507619959828cf87ef3f5cc (patch) | |
tree | 7491d1f37d555601e39100363a2ad7975483a758 | |
parent | 46bc4aef47c37ae087a558642455df6b5391447c (diff) | |
download | camera-0b21bf58d7eb232bf507619959828cf87ef3f5cc.tar.gz camera-0b21bf58d7eb232bf507619959828cf87ef3f5cc.tar.bz2 camera-0b21bf58d7eb232bf507619959828cf87ef3f5cc.zip |
Remove timeout for handle creation API
In handle creation API, muse camera module checks privilege for camera use,
but it can be stuck for a long time if app does not have camera privilege and there is no feedback for privilege popup.
[Version] 0.2.95
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-3.0-mobile_20170207.1]
Change-Id: Ib650afacd311d5e0a1854e4a68310766ad498d52
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r-- | include/camera_private.h | 1 | ||||
-rw-r--r-- | packaging/capi-media-camera.spec | 2 | ||||
-rw-r--r-- | src/camera.c | 21 |
3 files changed, 16 insertions, 8 deletions
diff --git a/include/camera_private.h b/include/camera_private.h index f1d3cd5..0fa2f77 100644 --- a/include/camera_private.h +++ b/include/camera_private.h @@ -35,6 +35,7 @@ extern "C" { #define BUFFER_MAX_PLANE_NUM 4 #define CAMERA_CB_TIMEOUT 4 +#define CAMERA_CB_NO_TIMEOUT 0 #define CAMERA_MSG_PARAM_SET(param, msg_type, set_value) { \ param.type = MUSE_TYPE_##msg_type; \ diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 23b65d9..c51262d 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.94 +Version: 0.2.95 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index 77f7912..a74860f 100644 --- a/src/camera.c +++ b/src/camera.c @@ -394,15 +394,22 @@ static int _camera_client_wait_for_cb_return(muse_camera_api_e api, camera_cb_in g_mutex_lock(&(cb_info->api_mutex[api])); if (cb_info->api_activating[api] == 0) { - end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND; - if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) { + if (time_out == CAMERA_CB_NO_TIMEOUT) { + LOGW("wait for api %d", api); + g_cond_wait(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api])); ret = cb_info->api_ret[api]; cb_info->api_activating[api] = 0; - - /*LOGD("return value : 0x%x", ret);*/ + LOGW("api %d returned 0x%x", api, ret); } else { - ret = CAMERA_ERROR_INVALID_OPERATION; - LOGE("api %d was TIMED OUT!", api); + end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND; + if (g_cond_wait_until(&(cb_info->api_cond[api]), &(cb_info->api_mutex[api]), end_time)) { + ret = cb_info->api_ret[api]; + cb_info->api_activating[api] = 0; + /*LOGD("return value : 0x%x", ret);*/ + } else { + ret = CAMERA_ERROR_INVALID_OPERATION; + LOGE("api %d was TIMED OUT!", api); + } } } else { ret = cb_info->api_ret[api]; @@ -2552,7 +2559,7 @@ int camera_create(camera_device_e device, camera_h *camera) LOGD("cb info : %d", pc->cb_info->fd); - ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_TIMEOUT); + ret = _camera_client_wait_for_cb_return(api, pc->cb_info, CAMERA_CB_NO_TIMEOUT); pc->cb_info->api_waiting[MUSE_CAMERA_API_CREATE] = 0; |