From b70e420db06ceb562cc5839bbdda638c6c004bf3 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Mon, 23 May 2022 15:48:24 +0900 Subject: [PATCH] Add TIZEN_FEATURE_NO_TIMEOUT_FOR_PREVIEW - In TV profile, set timeout for preview. - Additional change : Add error handling when service disconnected. [Version] 0.4.79 [Issue Type] Improvement Change-Id: I1579eb5ec4dc6b2d4c5fa932edfa15db734ebb27 Signed-off-by: Jeongmo Yang --- include/camera_private.h | 10 +++++++--- packaging/capi-media-camera.spec | 7 +++++-- src/camera.c | 18 +++++++++++++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/include/camera_private.h b/include/camera_private.h index 53d2978..10e0d66 100644 --- a/include/camera_private.h +++ b/include/camera_private.h @@ -31,9 +31,10 @@ extern "C" { #endif -#define CAMERA_CB_TIMEOUT 4 -#define CAMERA_CB_NO_TIMEOUT 0 -#define CAMERA_FD_INIT -1 +#define CAMERA_CB_TIMEOUT 4 +#define CAMERA_CB_NETWORK_PREVIEW_TIMEOUT 10 +#define CAMERA_CB_NO_TIMEOUT 0 +#define CAMERA_FD_INIT -1 #define CAMERA_IS_FD_VALID(fd) (fd > CAMERA_FD_INIT) @@ -178,6 +179,9 @@ typedef struct _camera_cb_info_s { /* preview stream */ MMCamcorderVideoStreamDataType *stream_data; + + /* network */ + gboolean is_network; } camera_cb_info_s; typedef struct _camera_message_s { diff --git a/packaging/capi-media-camera.spec b/packaging/capi-media-camera.spec index 361dbe5..869b69f 100644 --- a/packaging/capi-media-camera.spec +++ b/packaging/capi-media-camera.spec @@ -1,7 +1,7 @@ Name: capi-media-camera Summary: A Camera API -Version: 0.4.78 -Release: 2 +Version: 0.4.79 +Release: 0 Group: Multimedia/API License: Apache-2.0 Source0: %{name}-%{version}.tar.gz @@ -72,6 +72,9 @@ Collection of files related to Line Coverage. It is teseted as gcov for a camera %if 0%{?sec_build_binary_debug_enable} export CFLAGS+=" -DTIZEN_DEBUG_ENABLE" %endif +%if "%{tizen_profile_name}" != "tv" +export CFLAGS+=" -DTIZEN_FEATURE_NO_TIMEOUT_FOR_PREVIEW" +%endif %if 0%{?gcov:1} export CFLAGS+=" -fprofile-arcs -ftest-coverage" export LDFLAGS+=" -lgcov" diff --git a/src/camera.c b/src/camera.c index 919b526..e9ab2eb 100644 --- a/src/camera.c +++ b/src/camera.c @@ -697,6 +697,11 @@ int _camera_client_wait_for_cb_return(muse_camera_api_e api, camera_cb_info_s *c goto _CB_RETURN_END; } + if (!cb_info->is_server_connected) { + ret = CAMERA_ERROR_SERVICE_DISCONNECTED; + goto _CB_RETURN_END; + } + if (!cb_info->api_activating[api]) CAM_LOG_WARNING("invalid signal received, wait again..."); } @@ -2075,6 +2080,11 @@ static gpointer __camera_msg_recv_func(gpointer data) muse_core_msg_free(error_msg); error_msg = NULL; + for (i = 0 ; i < MUSE_CAMERA_API_MAX ; i++) { + if (cb_info->api_waiting[i]) + g_cond_broadcast(&cb_info->api_cond[i]); + } + CAM_LOG_ERROR("add error msg for service disconnection done"); } //LCOV_EXCL_STOP @@ -2542,6 +2552,7 @@ int _camera_create_private(camera_device_e device, bool is_network, camera_h *ca pc->cb_info->preview_format = preview_format; pc->cb_info->dp_info.type = CAMERA_DISPLAY_TYPE_NONE; pc->cb_info->user_buffer_supported = (gboolean)user_buffer_supported; + pc->cb_info->is_network = is_network; g_camera_log_level = log_level; CAM_LOG_INFO("default preview format %d, user buffer %d, log level %d", @@ -2708,7 +2719,12 @@ int camera_start_preview(camera_h camera) } } - _camera_msg_send(api, fds, pc->cb_info, &ret, CAMERA_CB_NO_TIMEOUT); + _camera_msg_send(api, fds, pc->cb_info, &ret, +#ifdef TIZEN_FEATURE_NO_TIMEOUT_FOR_PREVIEW + CAMERA_CB_NO_TIMEOUT); +#else + (pc->cb_info->is_network ? CAMERA_CB_NETWORK_PREVIEW_TIMEOUT : CAMERA_CB_TIMEOUT)); +#endif if (ret != CAMERA_ERROR_NONE) goto _START_FAILED; -- 2.7.4