Because of some reason, stopping preview can take much time.(some camera buffer is not returned.)
In that case, mm_camcorder_unrealize has timeout for resource release if resource release callback is come while stopping preview.
This patch prevent the situation and avoid the timeout.
[Version] 0.10.108
[Profile] Common
[Issue Type] Bug fix
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=]
Change-Id: I09443314107e6da9dda061300e2ad03343d2e9a6
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
Name: libmm-camcorder
Summary: Camera and recorder library
Name: libmm-camcorder
Summary: Camera and recorder library
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
/* resource manager for H/W resources */
MMCamcorderResourceManager resource_manager;
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
/* resource manager for H/W resources */
MMCamcorderResourceManager resource_manager;
+ gboolean resource_release_cb_calling;
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
/* gdbus */
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
/* gdbus */
}
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
}
#ifdef _MMCAMCORDER_MURPHY_SUPPORT
+ _mmcam_dbg_warn("lock resource - cb calling %d", hcamcorder->resource_release_cb_calling);
+
+ _MMCAMCORDER_LOCK_RESOURCE(hcamcorder);
+
if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE &&
if (hcamcorder->type == MM_CAMCORDER_MODE_VIDEO_CAPTURE &&
- hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_RM) {
+ hcamcorder->state_change_by_system != _MMCAMCORDER_STATE_CHANGE_BY_RM &&
+ hcamcorder->resource_release_cb_calling == FALSE) {
- _mmcam_dbg_log("lock resource");
- _MMCAMCORDER_LOCK_RESOURCE(hcamcorder);
-
/* release resource */
ret = _mmcamcorder_resource_manager_release(&hcamcorder->resource_manager);
if (ret == MM_ERROR_RESOURCE_INVALID_STATE) {
/* release resource */
ret = _mmcamcorder_resource_manager_release(&hcamcorder->resource_manager);
if (ret == MM_ERROR_RESOURCE_INVALID_STATE) {
_MMCAMCORDER_RESOURCE_WAIT_UNTIL(hcamcorder, end_time);
}
_MMCAMCORDER_RESOURCE_WAIT_UNTIL(hcamcorder, end_time);
}
-
- _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
- _mmcam_dbg_log("unlock resource");
+
+ _MMCAMCORDER_UNLOCK_RESOURCE(hcamcorder);
+
+ _mmcam_dbg_warn("unlock resource");
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
#ifdef _MMCAMCORDER_RM_SUPPORT
#endif /* _MMCAMCORDER_MURPHY_SUPPORT */
#ifdef _MMCAMCORDER_RM_SUPPORT
- _MMCAMCORDER_LOCK_ASM(camcorder);
+ _mmcam_dbg_warn("enter");
- /* set value to inform a status is changed by resource manaer */
- camcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_RM;
+ _MMCAMCORDER_LOCK_RESOURCE(camcorder);
if (!mrp_res_equal_resource_set(rs, camcorder->resource_manager.rset)) {
if (!mrp_res_equal_resource_set(rs, camcorder->resource_manager.rset)) {
- _MMCAMCORDER_UNLOCK_ASM(camcorder);
+ _MMCAMCORDER_UNLOCK_RESOURCE(camcorder);
_mmcam_dbg_warn("- resource set(%p) is not same as this camcorder handle's(%p)", rs, camcorder->resource_manager.rset);
return;
}
_mmcam_dbg_warn("- resource set(%p) is not same as this camcorder handle's(%p)", rs, camcorder->resource_manager.rset);
return;
}
+ /* set flag for resource release callback */
+ camcorder->resource_release_cb_calling = TRUE;
+
_mmcam_dbg_log(" - resource set state of camcorder(%p) is changed to [%s]",
camcorder, __mmcamcorder_resource_state_to_str(rs->state));
_mmcam_dbg_log(" - resource set state of camcorder(%p) is changed to [%s]",
camcorder, __mmcamcorder_resource_state_to_str(rs->state));
+ _MMCAMCORDER_UNLOCK_RESOURCE(camcorder);
+
+ _MMCAMCORDER_LOCK_ASM(camcorder);
+
+ /* set value to inform a status is changed by resource manager */
+ camcorder->state_change_by_system = _MMCAMCORDER_STATE_CHANGE_BY_RM;
+
/* Stop the camera */
__mmcamcorder_force_stop(camcorder);
/* Stop the camera */
__mmcamcorder_force_stop(camcorder);
_MMCAMCORDER_UNLOCK_ASM(camcorder);
_MMCAMCORDER_UNLOCK_ASM(camcorder);
+ _MMCAMCORDER_LOCK_RESOURCE(camcorder);
+
+ /* restore flag for resource release callback */
+ camcorder->resource_release_cb_calling = FALSE;
+
+ _MMCAMCORDER_UNLOCK_RESOURCE(camcorder);
+
+ _mmcam_dbg_warn("leave");
+