summaryrefslogtreecommitdiffstats
path: root/camera/OMXCameraAdapter
diff options
context:
space:
mode:
authorAkwasi Boateng <akwasi.boateng@ti.com>2011-11-24 12:35:58 +0200
committerIliyan Malchev <malchev@google.com>2011-12-01 12:20:00 -0800
commit2ded84ab4462cffc1b441345c8a2910498133b46 (patch)
treeaaf5b01db2e70c893eca3e3324740ac96ae4d0be /camera/OMXCameraAdapter
parenta5dbcd9b9845a98b85007229f93c167262d8590a (diff)
downloadhardware_ti_omap4-2ded84ab4462cffc1b441345c8a2910498133b46.zip
hardware_ti_omap4-2ded84ab4462cffc1b441345c8a2910498133b46.tar.gz
hardware_ti_omap4-2ded84ab4462cffc1b441345c8a2910498133b46.tar.bz2
CameraHAL: Fixes a couple of corner cases with AF and capture
- On some occasions during monkey tests, both the AF callback and the shutter callback can be delayed just enough to encounter the OMX component in loaded state. Usually this happens when the camera is getting closed and this scenario should be properly handled by exiting immediately without trying to trigger any callbacks to the client. Signed-off-by: Emilian Peev <epeev@mm-sol.com> Signed-off-by: Akwasi Boateng <akwasi.boateng@ti.com> Signed-off-by: Iliyan Malchev <malchev@google.com> Change-Id: Ia18faf471a8e10579b09973178d73e69e782c63c Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'camera/OMXCameraAdapter')
-rw-r--r--camera/OMXCameraAdapter/OMXCapture.cpp4
-rw-r--r--camera/OMXCameraAdapter/OMXFocus.cpp22
2 files changed, 15 insertions, 11 deletions
diff --git a/camera/OMXCameraAdapter/OMXCapture.cpp b/camera/OMXCameraAdapter/OMXCapture.cpp
index 3480619..e479b2c 100644
--- a/camera/OMXCameraAdapter/OMXCapture.cpp
+++ b/camera/OMXCameraAdapter/OMXCapture.cpp
@@ -843,8 +843,8 @@ status_t OMXCameraAdapter::startImageCapture()
ret = mStartCaptureSem.WaitTimeout(OMX_CAPTURE_TIMEOUT);
}
- //If somethiing bad happened while we wait
- if (mComponentState == OMX_StateInvalid)
+ //If something bad happened while we wait
+ if (mComponentState != OMX_StateExecuting)
{
CAMHAL_LOGEA("Invalid State after Image Capture Exitting!!!");
goto EXIT;
diff --git a/camera/OMXCameraAdapter/OMXFocus.cpp b/camera/OMXCameraAdapter/OMXFocus.cpp
index b48cfec..d9d4df4 100644
--- a/camera/OMXCameraAdapter/OMXFocus.cpp
+++ b/camera/OMXCameraAdapter/OMXFocus.cpp
@@ -173,7 +173,7 @@ status_t OMXCameraAdapter::doAutoFocus()
// force AF, Ducati will take care of whether CAF
// or AF will be performed, depending on light conditions
- if ( focusControl.eFocusControl == OMX_IMAGE_FocusControlAuto
+ if ( focusControl.eFocusControl == OMX_IMAGE_FocusControlAuto
&& focusStatus.eFocusStatus == OMX_FocusStatusUnableToReach )
{
focusControl.eFocusControl = OMX_IMAGE_FocusControlAutoLock;
@@ -193,16 +193,20 @@ status_t OMXCameraAdapter::doAutoFocus()
CAMHAL_LOGDA("Autofocus started successfully");
}
- // configure focus timeout based on capture mode
- timeout = (mCapMode == VIDEO_MODE) ? AF_VIDEO_CALLBACK_TIMEOUT : AF_IMAGE_CALLBACK_TIMEOUT;
+ // configure focus timeout based on capture mode
+ timeout = (mCapMode == VIDEO_MODE) ? AF_VIDEO_CALLBACK_TIMEOUT : AF_IMAGE_CALLBACK_TIMEOUT;
- if(mDoAFSem.WaitTimeout(timeout) != NO_ERROR) {
- //If somethiing bad happened while we wait
- if (mComponentState == OMX_StateInvalid) {
- CAMHAL_LOGEA("Invalid State after Auto Focus Exitting!!!");
- return EINVAL;
- }
+ ret = mDoAFSem.WaitTimeout(timeout);
+ //If somethiing bad happened while we wait
+ if (mComponentState == OMX_StateInvalid) {
+ CAMHAL_LOGEA("Invalid State after Auto Focus Exitting!!!");
+ return EINVAL;
+ }
+ if( ret != NO_ERROR) {
+ //Disable auto focus callback from Ducati
+ setFocusCallback(false);
+ CAMHAL_LOGEA("Autofocus callback timeout expired");
RemoveEvent(mCameraAdapterParameters.mHandleComp,
(OMX_EVENTTYPE) OMX_EventIndexSettingChanged,
OMX_ALL,