From 50887d474bb0e9f21df206ffbe578949c336cb57 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 11 May 2022 14:47:32 +0900 Subject: [PATCH] Create missed thread for preview callback - The thread for preview callback is created in camera_start_preview(), but, it could be skipped with recorder_prepare() when video recording. [Version] 0.4.77 [Issue Type] Bug fix Change-Id: I89aeaea03b392226a2c19c224445237599f6ce43 Signed-off-by: Jeongmo Yang --- packaging/capi-media-camera.spec | 2 +- src/camera.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 66bd4ec..2a7afe8 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.76 +Version: 0.4.77 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/camera.c b/src/camera.c index 787aff8..56cf058 100644 --- a/src/camera.c +++ b/src/camera.c @@ -1828,6 +1828,16 @@ static void __camera_add_msg_to_queue(camera_cb_info_s *cb_info, int api, int ev api, event, event_class); if (event == MUSE_CAMERA_EVENT_TYPE_PREVIEW) { + if (!cb_info->preview_cb_info.thread) { + LOGI("The thread for preview cb is not created yet, create it now"); + if (!__create_msg_handler_thread(&cb_info->preview_cb_info, + CAMERA_MESSAGE_HANDLER_TYPE_PREVIEW_CB, "cam:preview_cb", cb_info)) { + CAM_LOG_ERROR("failed to create thread for preview cb"); + g_free(cam_msg); + return; + } + } + g_mutex_lock(&cb_info->preview_cb_info.mutex); g_queue_push_tail(cb_info->preview_cb_info.queue, (gpointer)cam_msg); g_cond_signal(&cb_info->preview_cb_info.cond); -- 2.7.4