From 10f916460d7874581a513d2cb695b2e47849ee92 Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Mon, 29 Oct 2018 15:11:37 +0900 Subject: [PATCH] Update error handling for capture while recording - Move timing to check error for target which does not support capture while recording. - Remove unnecessary error message in this case, because the error is already returned. [Version] 0.10.170 [Profile] Common [Issue Type] Bug fix [Dependency module] N/A [Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20181024.1] Change-Id: I7ca3f358d534da6a1e1cd77831b0cf908b86b569 Signed-off-by: Jeongmo Yang --- packaging/libmm-camcorder.spec | 4 ++-- src/mm_camcorder_stillshot.c | 36 +++++++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index 3ec816c..fa0c5be 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -1,7 +1,7 @@ Name: libmm-camcorder Summary: Camera and recorder library -Version: 0.10.169 -Release: 1 +Version: 0.10.170 +Release: 0 Group: Multimedia/Libraries License: Apache-2.0 Source0: %{name}-%{version}.tar.gz diff --git a/src/mm_camcorder_stillshot.c b/src/mm_camcorder_stillshot.c index 7fece95..ad832d6 100644 --- a/src/mm_camcorder_stillshot.c +++ b/src/mm_camcorder_stillshot.c @@ -394,6 +394,12 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) /* check state */ if (current_state >= MM_CAMCORDER_STATE_RECORDING) { + if (sc->bencbin_capture) { + _mmcam_dbg_err("could not capture in this target while recording"); + ret = MM_ERROR_CAMCORDER_INVALID_STATE; + goto cmd_done; + } + if (info->type == _MMCamcorder_MULTI_SHOT || info->hdr_capture_mode != MM_CAMCORDER_HDR_OFF) { _mmcam_dbg_err("does not support multi/HDR capture while recording"); @@ -464,12 +470,6 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) int set_height = 0; int cap_jpeg_quality = 0; - if (current_state >= MM_CAMCORDER_STATE_RECORDING) { - _mmcam_dbg_err("could not capture in this target while recording"); - ret = MM_ERROR_CAMCORDER_INVALID_STATE; - goto cmd_done; - } - if (UseCaptureMode) { if (width != MMFCAMCORDER_HIGHQUALITY_WIDTH || height != MMFCAMCORDER_HIGHQUALITY_HEIGHT) need_change = 1; @@ -600,9 +600,31 @@ int _mmcamcorder_image_cmd_capture(MMHandleType handle) } cmd_done: - if (ret != MM_ERROR_NONE) + if (ret != MM_ERROR_NONE) { info->capturing = FALSE; + /* sound finalize */ + if (info->type == _MMCamcorder_MULTI_SHOT) + _mmcamcorder_sound_finalize(handle); + + /* send signal for task thread : It prevent unnecessary invalid operation error in task thread */ + if (hcamcorder->capture_in_recording) { + hcamcorder->capture_in_recording = FALSE; + + g_mutex_lock(&hcamcorder->task_thread_lock); + + if (hcamcorder->task_thread_state == _MMCAMCORDER_TASK_THREAD_STATE_CHECK_CAPTURE_IN_RECORDING) { + hcamcorder->task_thread_state = _MMCAMCORDER_TASK_THREAD_STATE_NONE; + _mmcam_dbg_log("send signal for capture in recording"); + g_cond_signal(&hcamcorder->task_thread_cond); + } else { + _mmcam_dbg_warn("unexpected task thread state : %d", hcamcorder->task_thread_state); + } + + g_mutex_unlock(&hcamcorder->task_thread_lock); + } + } + return ret; } -- 2.7.4