summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2016-01-12 18:40:11 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2016-01-13 13:44:49 +0900
commitdd1fd138ff2a1741f216444ccf31359aaf982de0 (patch)
treea08eb8e76c51a899dbd3ce6365ef83cb8dff1cf7
parent46d82b93e8778160a8970c2052e3d5d6443fb956 (diff)
downloadcamera-dd1fd138ff2a1741f216444ccf31359aaf982de0.tar.gz
camera-dd1fd138ff2a1741f216444ccf31359aaf982de0.tar.bz2
camera-dd1fd138ff2a1741f216444ccf31359aaf982de0.zip
[Release version 0.2.36] Fix bug - media packet preview callback is not invoked, camera_start_preview is sometimes failedsubmit/tizen/20160113.072711accepted/tizen/wearable/20160114.012049accepted/tizen/tv/20160114.012026accepted/tizen/mobile/20160114.012010
Change-Id: Iba0295b8f03a590986f491017daa896979a17b10 Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--include/camera_private.h1
-rw-r--r--packaging/capi-media-camera.spec2
-rw-r--r--src/camera.c46
3 files changed, 41 insertions, 8 deletions
diff --git a/include/camera_private.h b/include/camera_private.h
index 95865a5..c520298 100644
--- a/include/camera_private.h
+++ b/include/camera_private.h
@@ -53,6 +53,7 @@ typedef struct _camera_cb_info_s {
gint *api_ret;
tbm_bufmgr bufmgr;
gint prev_state;
+ gchar *caps;
media_format_h pkt_fmt;
} camera_cb_info_s;
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index c7cb1a8..b960531 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.35
+Version: 0.2.36
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/camera.c b/src/camera.c
index 702ec1c..d00c594 100644
--- a/src/camera.c
+++ b/src/camera.c
@@ -453,7 +453,13 @@ static void _client_user_callback(camera_cb_info_s *cb_info, char *recv_msg, mus
LOGD("get camera msg %s, event %d", recv_msg, event);
- if (cb_info->user_cb[event] == NULL) {
+ if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) {
+ if (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;
+ }
+ } else if (cb_info->user_cb[event] == NULL) {
LOGW("user callback for event %d is not set", event);
return;
}
@@ -1413,7 +1419,6 @@ static void *_camera_msg_recv_func(gpointer data)
int num_token = 0;
int str_pos = 0;
int prev_pos = 0;
- int prev_state = CAMERA_STATE_NONE;
char *recv_msg = NULL;
char **parse_str = NULL;
camera_cb_info_s *cb_info = (camera_cb_info_s *)data;
@@ -1508,8 +1513,30 @@ static void *_camera_msg_recv_func(gpointer data)
LOGD("camera destroy done. close client cb handler");
}
} else if (api == MUSE_CAMERA_API_START_PREVIEW) {
+ int prev_state = CAMERA_STATE_NONE;
+ gchar caps[MUSE_CAMERA_MSG_MAX_LENGTH] = {'\0',};
+
muse_camera_msg_get(prev_state, parse_str[i]);
+
cb_info->prev_state = prev_state;
+ if (prev_state == CAMERA_STATE_CREATED) {
+ if (cb_info->caps) {
+ g_free(cb_info->caps);
+ cb_info->caps = NULL;
+ }
+
+ muse_camera_msg_get(caps, parse_str[i]);
+ if (strlen(caps) > 0) {
+ cb_info->caps = g_strdup(caps);
+ if (cb_info->caps) {
+ LOGD("caps from server [%s]", cb_info->caps);
+ } else {
+ LOGE("failed to copy caps string");
+ }
+ } else {
+ LOGE("no string for caps");
+ }
+ }
}
g_cond_signal(&cb_info->api_cond[api]);
@@ -1723,6 +1750,10 @@ static void _client_callback_destroy(camera_cb_info_s *cb_info)
media_format_unref(cb_info->pkt_fmt);
cb_info->pkt_fmt = NULL;
}
+ if (cb_info->caps) {
+ g_free(cb_info->caps);
+ cb_info->caps = NULL;
+ }
g_free(cb_info);
cb_info = NULL;
@@ -1878,7 +1909,6 @@ int camera_start_preview(camera_h camera)
muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
camera_cli_s *pc = (camera_cli_s *)camera;
int sock_fd = 0;
- char caps[MUSE_CAMERA_MSG_MAX_LENGTH] = {0};
if (camera == NULL) {
LOGE("INVALID_PARAMETER(0x%08x)", CAMERA_ERROR_INVALID_PARAMETER);
@@ -1911,14 +1941,16 @@ int camera_start_preview(camera_h camera)
}
if (pc->cb_info->prev_state == CAMERA_STATE_CREATED) {
- if (muse_camera_msg_get_string(caps, pc->cb_info->recv_msg) == FALSE) {
- LOGE("failed to get caps string");
+ if (pc->cb_info->caps == NULL) {
+ LOGE("caps string is NULL");
goto _START_PREVIEW_ERROR;
}
- LOGD("caps : %s", caps);
+ ret = mm_camcorder_client_realize(pc->client_handle, pc->cb_info->caps);
+
+ g_free(pc->cb_info->caps);
+ pc->cb_info->caps = NULL;
- ret = mm_camcorder_client_realize(pc->client_handle, caps);
if (ret != MM_ERROR_NONE) {
LOGE("client realize failed 0x%x", ret);
goto _START_PREVIEW_ERROR;