Create missed thread for preview callback 69/274869/2 accepted/tizen/unified/20220511.210840 submit/tizen/20220511.062357
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 11 May 2022 05:47:32 +0000 (14:47 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 11 May 2022 06:04:04 +0000 (15:04 +0900)
- 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 <jm80.yang@samsung.com>
packaging/capi-media-camera.spec
src/camera.c

index 66bd4ec..2a7afe8 100644 (file)
@@ -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
index 787aff8..56cf058 100644 (file)
@@ -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);