summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeongmo Yang <jm80.yang@samsung.com>2022-01-10 16:21:59 +0900
committerJeongmo Yang <jm80.yang@samsung.com>2022-01-10 16:22:11 +0900
commit7afa114f6fe4e9f42d9f9729f9dec60716af0290 (patch)
tree0cd13151a78910e133f72940ff24d9a63f22137d
parent589305a1b506f47df18dadb96ff5b8b8a99c06d5 (diff)
parent755c1ecf7eb7aaaa147b9e2433f5e72ab7d75eac (diff)
downloadcamera-submit/tizen_6.5/20220110.092659.tar.gz
camera-submit/tizen_6.5/20220110.092659.tar.bz2
camera-submit/tizen_6.5/20220110.092659.zip
Change-Id: I579cb612669df1c84e7d15bcdc6628f5c3caa6aa Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
-rw-r--r--packaging/capi-media-camera.spec2
-rw-r--r--src/camera.c34
-rw-r--r--test/camera_test.c13
3 files changed, 38 insertions, 11 deletions
diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec
index 8e2032b..495fc0e 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.4.68
+Version: 0.4.71
Release: 0
Group: Multimedia/API
License: Apache-2.0
diff --git a/src/camera.c b/src/camera.c
index 578efee..46679c0 100644
--- a/src/camera.c
+++ b/src/camera.c
@@ -56,6 +56,10 @@ static gboolean __camera_allocate_preview_buffer(camera_h camera);
static void __camera_release_preview_buffer(camera_h camera);
static void __camera_release_tfd(int tfd[MUSE_NUM_FD]);
+static bool __create_msg_handler_thread(camera_msg_handler_info_s *handler_info,
+ int type, const char *thread_name, camera_cb_info_s *cb_info);
+static void __destroy_msg_handler_thread(camera_msg_handler_info_s *handler_info);
+
static gboolean __camera_allocate_preview_buffer(camera_h camera)
{
@@ -1599,7 +1603,7 @@ static gpointer __camera_msg_handler_func(gpointer data)
cb_info = (camera_cb_info_s *)handler_info->cb_info;
type = handler_info->type;
- CAM_LOG_INFO("t:%d start", type);
+ CAM_LOG_INFO("t:%d start[thread:%p]", type, handler_info->thread);
g_mutex_lock(&handler_info->mutex);
@@ -1649,6 +1653,11 @@ static gpointer __camera_msg_handler_func(gpointer data)
g_mutex_unlock(&cb_info->api_mutex[api]);
} else if (api == MUSE_CAMERA_CB_EVENT) {
+ if (cam_msg->event == MUSE_CAMERA_EVENT_TYPE_INTERRUPTED) {
+ CAM_LOG_WARNING("INTERRUPTED, release thread for preview cb");
+ __destroy_msg_handler_thread(&cb_info->preview_cb_info);
+ }
+
switch (cam_msg->event_class) {
case MUSE_CAMERA_EVENT_CLASS_THREAD_SUB:
__camera_client_user_callback(cb_info, cam_msg->recv_msg, cam_msg->event, cam_msg->tfd);
@@ -1706,7 +1715,7 @@ static gpointer __camera_msg_handler_func(gpointer data)
g_mutex_unlock(&handler_info->mutex);
- CAM_LOG_INFO("t:%d return", type);
+ CAM_LOG_INFO("t:%d return[thread:%p]", type, handler_info->thread);
return NULL;
}
@@ -2040,7 +2049,12 @@ static bool __create_msg_handler_thread(camera_msg_handler_info_s *handler_info,
return false;
}
- CAM_LOG_INFO("t:%d", type);
+ if (handler_info->thread) {
+ CAM_LOG_WARNING("t:%d thread[%p] is already created", type, handler_info->thread);
+ return true;
+ }
+
+ CAM_LOG_INFO("t:%d [%s]", type, thread_name);
handler_info->type = type;
handler_info->queue = g_queue_new();
@@ -2068,7 +2082,7 @@ static bool __create_msg_handler_thread(camera_msg_handler_info_s *handler_info,
return false;
}
- CAM_LOG_INFO("t:%d done", type);
+ CAM_LOG_INFO("t:%d done[thread:%p]", type, handler_info->thread);
return true;
}
@@ -2090,7 +2104,7 @@ static void __destroy_msg_handler_thread(camera_msg_handler_info_s *handler_info
type = handler_info->type;
- CAM_LOG_INFO("t:%d thread %p", type, handler_info->thread);
+ CAM_LOG_INFO("t:%d thread[%p]", type, handler_info->thread);
g_mutex_lock(&handler_info->mutex);
g_atomic_int_set(&handler_info->running, 0);
@@ -2138,14 +2152,14 @@ static camera_cb_info_s *__camera_client_callback_new(gint sockfd)
/* message handler thread */
if (!__create_msg_handler_thread(&cb_info->msg_handler_info,
- CAMERA_MESSAGE_HANDLER_TYPE_GENERAL, "camera_msg_handler", cb_info)) {
+ CAMERA_MESSAGE_HANDLER_TYPE_GENERAL, "cam:msg_handler", cb_info)) {
CAM_LOG_ERROR("msg_handler_info failed");
goto ErrorExit;
}
/* message handler thread for capture callback */
if (!__create_msg_handler_thread(&cb_info->capture_cb_info,
- CAMERA_MESSAGE_HANDLER_TYPE_CAPTURE_CB, "camera_msg_handler:capture_cb", cb_info)) {
+ CAMERA_MESSAGE_HANDLER_TYPE_CAPTURE_CB, "cam:capture_cb", cb_info)) {
CAM_LOG_ERROR("capture_cb_info failed");
goto ErrorExit;
}
@@ -2154,7 +2168,7 @@ static camera_cb_info_s *__camera_client_callback_new(gint sockfd)
/* message receive thread */
g_atomic_int_set(&cb_info->msg_recv_running, 1);
- cb_info->msg_recv_thread = g_thread_try_new("camera_msg_recv",
+ cb_info->msg_recv_thread = g_thread_try_new("cam:msg_recv",
__camera_msg_recv_func, (gpointer)cb_info, NULL);
if (cb_info->msg_recv_thread == NULL) {
CAM_LOG_ERROR("message receive thread creation failed");
@@ -2208,6 +2222,8 @@ static void __camera_client_callback_destroy(camera_cb_info_s *cb_info)
CAM_LOG_INFO("msg_recv thread removed");
/* destroy msg handler threads */
+ if (cb_info->preview_cb_info.thread)
+ __destroy_msg_handler_thread(&cb_info->preview_cb_info);
__destroy_msg_handler_thread(&cb_info->msg_handler_info);
__destroy_msg_handler_thread(&cb_info->capture_cb_info);
@@ -2634,7 +2650,7 @@ int camera_start_preview(camera_h camera)
if (current_state == CAMERA_STATE_CREATED) {
if (!__create_msg_handler_thread(&pc->cb_info->preview_cb_info,
- CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB, "camera_msg_handler:preview_cb", pc->cb_info)) {
+ CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB, "cam:preview_cb", pc->cb_info)) {
CAM_LOG_ERROR("preview_cb_info failed");
return CAMERA_ERROR_INVALID_OPERATION;
}
diff --git a/test/camera_test.c b/test/camera_test.c
index 3e00513..52f7e29 100644
--- a/test/camera_test.c
+++ b/test/camera_test.c
@@ -130,7 +130,7 @@ static media_bridge_h bridge;
#define SENSOR_AF_SCAN_NUM 4
#define SENSOR_ISO_NUM 8
#define SENSOR_EXPOSURE_NUM 9
-#define SENSOR_IMAGE_FORMAT 9
+#define SENSOR_IMAGE_FORMAT 20
/*-----------------------------------------------------------------------
@@ -305,6 +305,17 @@ const char *image_fmt[SENSOR_IMAGE_FORMAT] = {
"422P",
"I420",
"YV12",
+ "RGB565",
+ "RGB888",
+ "RGBA",
+ "ARGB",
+ "JPEG",
+ "ITLV(YUYV+JPEG, but should not be seen)",
+ "H264",
+ "INVZ",
+ "MJPEG",
+ "VP8",
+ "VP9"
};
const char *face_zoom_mode[] = {