summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2012-11-07 16:54:31 -0800
committerEino-Ville Talvala <etalvala@google.com>2012-11-07 16:54:31 -0800
commit707e301de8b52780a7f0e88e6f25ac919c23671f (patch)
treebb3435c3b0fac8bf78867774fdfb2f3c870cdfd9 /camera
parentb96dffd40e25d29a61f9fbd7f2e5968b5335b957 (diff)
downloadhardware_ti_omap4xxx-707e301de8b52780a7f0e88e6f25ac919c23671f.zip
hardware_ti_omap4xxx-707e301de8b52780a7f0e88e6f25ac919c23671f.tar.gz
hardware_ti_omap4xxx-707e301de8b52780a7f0e88e6f25ac919c23671f.tar.bz2
Revert "CameraHal: Sync AF cancel with incoming OMX events"
This reverts commit b96dffd40e25d29a61f9fbd7f2e5968b5335b957. Bug: 7495861
Diffstat (limited to 'camera')
-rw-r--r--camera/OMXCameraAdapter/OMXFocus.cpp72
-rw-r--r--camera/inc/OMXCameraAdapter/OMXCameraAdapter.h4
2 files changed, 23 insertions, 53 deletions
diff --git a/camera/OMXCameraAdapter/OMXFocus.cpp b/camera/OMXCameraAdapter/OMXFocus.cpp
index e50b005..be1dfc5 100644
--- a/camera/OMXCameraAdapter/OMXFocus.cpp
+++ b/camera/OMXCameraAdapter/OMXFocus.cpp
@@ -36,8 +36,6 @@
namespace android {
-const nsecs_t OMXCameraAdapter::CANCEL_AF_TIMEOUT = seconds_to_nanoseconds(1);
-
status_t OMXCameraAdapter::setParametersFocus(const CameraParameters &params,
BaseCameraAdapter::AdapterState state)
{
@@ -110,14 +108,6 @@ status_t OMXCameraAdapter::doAutoFocus()
return NO_ERROR;
}
- // AF when fixed focus modes are set should be a no-op.
- if ( ( mParameters3A.Focus == OMX_IMAGE_FocusControlOff ) ||
- ( mParameters3A.Focus == OMX_IMAGE_FocusControlAutoInfinity ) ||
- ( mParameters3A.Focus == OMX_IMAGE_FocusControlHyperfocal ) ) {
- returnFocusStatus(true);
- return NO_ERROR;
- }
-
OMX_INIT_STRUCT_PTR (&focusStatus, OMX_PARAM_FOCUSSTATUSTYPE);
// If the app calls autoFocus, the camera will stop sending face callbacks.
@@ -171,12 +161,6 @@ status_t OMXCameraAdapter::doAutoFocus()
eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp,
(OMX_INDEXTYPE)OMX_TI_IndexConfigAutofocusEnable,
&bOMX);
- if ( OMX_ErrorNone != eError ) {
- return ErrorUtils::omxToAndroidError(eError);
- }
-
- {
- android::AutoMutex lock(mDoAFMutex);
// force AF, Ducati will take care of whether CAF
// or AF will be performed, depending on light conditions
@@ -191,23 +175,24 @@ status_t OMXCameraAdapter::doAutoFocus()
eError = OMX_SetConfig(mCameraAdapterParameters.mHandleComp,
OMX_IndexConfigFocusControl,
&focusControl);
-
- if ( OMX_ErrorNone != eError ) {
- CAMHAL_LOGEB("Error while starting focus 0x%x", eError);
- return INVALID_OPERATION;
- } else {
- CAMHAL_LOGDA("Autofocus started successfully");
}
- // configure focus timeout based on capture mode
- timeout = (mCapMode == VIDEO_MODE) ?
+ if ( OMX_ErrorNone != eError ) {
+ CAMHAL_LOGEB("Error while starting focus 0x%x", eError);
+ return INVALID_OPERATION;
+ } else {
+ CAMHAL_LOGDA("Autofocus started successfully");
+ }
+
+ // configure focus timeout based on capture mode
+ timeout = (mCapMode == VIDEO_MODE) ?
( ( nsecs_t ) AF_VIDEO_CALLBACK_TIMEOUT * 1000 ) :
( ( nsecs_t ) AF_IMAGE_CALLBACK_TIMEOUT * 1000 );
-
+ {
+ Mutex::Autolock lock(mDoAFMutex);
ret = mDoAFCond.waitRelative(mDoAFMutex, timeout);
}
- } // mDoAFMutex lock ends here
//If somethiing bad happened while we wait
if (mComponentState == OMX_StateInvalid) {
@@ -237,7 +222,6 @@ status_t OMXCameraAdapter::stopAutoFocus()
{
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE focusControl;
- status_t ret = NO_ERROR;
LOG_FUNCTION_NAME;
@@ -269,11 +253,19 @@ status_t OMXCameraAdapter::stopAutoFocus()
{
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();
}
+
LOG_FUNCTION_NAME_EXIT;
- return ret;
+ return NO_ERROR;
}
status_t OMXCameraAdapter::getFocusMode(OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE &focusMode)
@@ -319,27 +311,14 @@ status_t OMXCameraAdapter::cancelAutoFocus()
//Stop the AF only for modes other than CAF or Inifinity
if ( ( focusMode.eFocusControl != OMX_IMAGE_FocusControlAuto ) &&
( focusMode.eFocusControl != ( OMX_IMAGE_FOCUSCONTROLTYPE )
- OMX_IMAGE_FocusControlAutoInfinity ) &&
- ( focusMode.eFocusControl != OMX_IMAGE_FocusControlOff ) ) {
- android::AutoMutex lock(mCancelAFMutex);
+ OMX_IMAGE_FocusControlAutoInfinity ) ) {
stopAutoFocus();
- ret = mCancelAFCond.waitRelative(mCancelAFMutex, CANCEL_AF_TIMEOUT);
- if ( NO_ERROR != ret ) {
- CAMHAL_LOGEA("Cancel AF timeout!");
- }
} else if (focusMode.eFocusControl == OMX_IMAGE_FocusControlAuto) {
// This re-enabling of CAF doesn't seem to
// be needed any more.
// re-apply CAF after unlocking and canceling
// mPending3Asettings |= SetFocus;
}
-
- {
- // Signal to 'doAutoFocus()'
- android::AutoMutex lock(mDoAFMutex);
- mDoAFCond.broadcast();
- }
-
// If the apps call #cancelAutoFocus()}, the face callbacks will also resume.
pauseFaceDetection(false);
@@ -829,13 +808,8 @@ void OMXCameraAdapter::handleFocusCallback() {
return;
}
- if ( eFocusStatus.eFocusStatus == OMX_FocusStatusOff ) {
- android::AutoMutex lock(mCancelAFMutex);
- mCancelAFCond.signal();
- return;
- }
-
- if (eFocusStatus.eFocusStatus != OMX_FocusStatusRequest) {
+ if ( ( eFocusStatus.eFocusStatus != OMX_FocusStatusRequest ) &&
+ ( eFocusStatus.eFocusStatus != OMX_FocusStatusOff ) ) {
// signal doAutoFocus when a end of scan message comes
// ignore start of scan
Mutex::Autolock lock(mDoAFMutex);
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
index 1f1fd9f..59c5efc 100644
--- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
+++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
@@ -939,10 +939,6 @@ private:
Mutex mFrameCountMutex;
Condition mFirstFrameCondition;
- static const nsecs_t CANCEL_AF_TIMEOUT;
- Mutex mCancelAFMutex;
- Condition mCancelAFCond;
-
Mutex mDoAFMutex;
Condition mDoAFCond;