summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2016-01-13 20:32:10 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2016-01-13 20:32:10 +0900
commitd9aa0f4dde3ea2c94b9cf6aabd168a9e58f85557 (patch)
treeffb8a8461b66a5df0bf952ee209d30ad486231ac
parentdd1fd138ff2a1741f216444ccf31359aaf982de0 (diff)
downloadcamera-d9aa0f4dde3ea2c94b9cf6aabd168a9e58f85557.tar.gz
camera-d9aa0f4dde3ea2c94b9cf6aabd168a9e58f85557.tar.bz2
camera-d9aa0f4dde3ea2c94b9cf6aabd168a9e58f85557.zip
Change-Id: I5bab8c7e50037b2d24f491700469230ab5205454 Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--packaging/capi-media-camera.spec2
-rw-r--r--src/camera.c45
2 files changed, 25 insertions, 22 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index b960531..01e56e3 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.36
+Version: 0.2.37
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/camera.c b/src/camera.c
index d00c594..e7dff8d 100644
--- a/src/camera.c
+++ b/src/camera.c
@@ -1947,10 +1947,6 @@ int camera_start_preview(camera_h camera)
}
ret = mm_camcorder_client_realize(pc->client_handle, pc->cb_info->caps);
-
- g_free(pc->cb_info->caps);
- pc->cb_info->caps = NULL;
-
if (ret != MM_ERROR_NONE) {
LOGE("client realize failed 0x%x", ret);
goto _START_PREVIEW_ERROR;
@@ -1969,14 +1965,18 @@ _START_PREVIEW_ERROR:
int camera_stop_preview(camera_h camera)
{
+ int ret = CAMERA_ERROR_NONE;
+ int client_ret = MM_ERROR_NONE;
+ int sock_fd = 0;
+ camera_cli_s *pc = NULL;
+ muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
+
if (camera == NULL) {
LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
return CAMERA_ERROR_INVALID_PARAMETER;
}
- int ret = CAMERA_ERROR_NONE;
- camera_cli_s *pc = (camera_cli_s *)camera;
- int sock_fd;
- muse_camera_api_e api = MUSE_CAMERA_API_STOP_PREVIEW;
+
+ pc = (camera_cli_s *)camera;
if (pc->cb_info == NULL) {
LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
@@ -1984,26 +1984,29 @@ int camera_stop_preview(camera_h camera)
}
sock_fd = pc->cb_info->fd;
- LOGD("Enter");
- muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
- if (ret != CAMERA_ERROR_NONE) {
- LOGE("stop preview failed 0x%x", ret);
- return ret;
- }
+ LOGD("Enter");
+ /* destroy client pipeline first */
if (pc->client_handle != NULL) {
- if (mm_camcorder_client_unrealize(pc->client_handle) == MM_ERROR_NONE) {
- LOGD("client unrealize done");
- } else {
- LOGE("client unrealize failed. restart preview...");
- muse_camera_msg_send_longtime(MUSE_CAMERA_API_START_PREVIEW, sock_fd, pc->cb_info, ret);
- return CAMERA_ERROR_INVALID_OPERATION;
- }
+ client_ret = mm_camcorder_client_unrealize(pc->client_handle);
} else {
LOGW("client handle is NULL");
}
+ /* send stop preview message */
+ muse_camera_msg_send(api, sock_fd, pc->cb_info, ret);
+
+ if (ret == MM_ERROR_NONE && client_ret != MM_ERROR_NONE) {
+ LOGE("client unrealize failed, restart preview");
+ muse_camera_msg_send_longtime(MUSE_CAMERA_API_START_PREVIEW, sock_fd, pc->cb_info, ret);
+ ret = CAMERA_ERROR_INVALID_OPERATION;
+ } else if (ret != MM_ERROR_NONE && client_ret == MM_ERROR_NONE) {
+ LOGE("stop preview failed, realize client again");
+ mm_camcorder_client_realize(pc->client_handle, pc->cb_info->caps);
+ ret = CAMERA_ERROR_INVALID_OPERATION;
+ }
+
LOGD("ret : 0x%x", ret);
return ret;