summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorEmilian Peev <epeev@mm-sol.com>2012-02-14 08:57:09 +0200
committerIliyan Malchev <malchev@google.com>2012-02-14 09:34:22 -0800
commit5703f6d63cead1c511f23531cfb13c5ba6de576b (patch)
tree4015858205976e3b19dc5e65df0458adf9b088cd /camera
parentc0a3e7982ae5b18bd857b188271cea807250af89 (diff)
downloadhardware_ti_omap4xxx-5703f6d63cead1c511f23531cfb13c5ba6de576b.zip
hardware_ti_omap4xxx-5703f6d63cead1c511f23531cfb13c5ba6de576b.tar.gz
hardware_ti_omap4xxx-5703f6d63cead1c511f23531cfb13c5ba6de576b.tar.bz2
CameraHal: Workaround for delayed AF events
Addresses a corner case with b/5534973 - If the OMX Camera component delays ( for whatever reason ) the AF status notification during cancelAF, then there is a chance that the AF callback timeout inside 'doAutoFocus()' might expire and an incorrect failed AF callback might be generated to the client. What this change does is to immediately unblock the thread waiting for AF status after the configuration for stopping AF. This way we are effectively skipping the wait on the OMX component. Change-Id: Ieda419b3ceee20eee80b543a00cd59b8f51d1cbe Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Diffstat (limited to 'camera')
-rw-r--r--camera/OMXCameraAdapter/OMXFocus.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/camera/OMXCameraAdapter/OMXFocus.cpp b/camera/OMXCameraAdapter/OMXFocus.cpp
index 089d376..fcc2010 100644
--- a/camera/OMXCameraAdapter/OMXFocus.cpp
+++ b/camera/OMXCameraAdapter/OMXFocus.cpp
@@ -217,7 +217,6 @@ status_t OMXCameraAdapter::doAutoFocus()
status_t OMXCameraAdapter::stopAutoFocus()
{
- status_t ret = NO_ERROR;
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE focusControl;
@@ -241,24 +240,29 @@ status_t OMXCameraAdapter::stopAutoFocus()
return NO_ERROR;
}
- if ( NO_ERROR == ret )
+ OMX_INIT_STRUCT_PTR (&focusControl, OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE);
+ focusControl.eFocusControl = OMX_IMAGE_FocusControlOff;
+
+ eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp,
+ OMX_IndexConfigFocusControl,
+ &focusControl);
+ if ( OMX_ErrorNone != eError )
{
- OMX_INIT_STRUCT_PTR (&focusControl, OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE);
- focusControl.eFocusControl = OMX_IMAGE_FocusControlOff;
+ CAMHAL_LOGEB("Error while stopping focus 0x%x", eError);
+ return ErrorUtils::omxToAndroidError(eError);
+ } else {
+ // This is a WA. Usually the OMX Camera component should
+ // generate AF status change OMX event fairly quickly
+ // ( after one preview frame ) and this notification should
+ // actually come from 'handleFocusCallback()'.
+ Mutex::Autolock lock(mDoAFMutex);
+ mDoAFCond.broadcast();
+ }
- eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp,
- OMX_IndexConfigFocusControl,
- &focusControl);
- if ( OMX_ErrorNone != eError )
- {
- CAMHAL_LOGEB("Error while stopping focus 0x%x", eError);
- return ErrorUtils::omxToAndroidError(eError);
- }
- }
LOG_FUNCTION_NAME_EXIT;
- return ret;
+ return NO_ERROR;
}
status_t OMXCameraAdapter::getFocusMode(OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE &focusMode)