diff options
author | Tyler Luu <tluu@ti.com> | 2011-08-15 23:57:24 -0500 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-08-23 18:11:57 +0800 |
commit | aa6e62e279cb54ae76c55ba9f8d02da230ce34e7 (patch) | |
tree | f0b425293d804f3f459b1f9dd509f73b90d65b01 | |
parent | 00fd87fc096d092bfbe3579cd7fe2c1824e6eac0 (diff) | |
download | hardware_ti_omap4xxx-aa6e62e279cb54ae76c55ba9f8d02da230ce34e7.zip hardware_ti_omap4xxx-aa6e62e279cb54ae76c55ba9f8d02da230ce34e7.tar.gz hardware_ti_omap4xxx-aa6e62e279cb54ae76c55ba9f8d02da230ce34e7.tar.bz2 |
CameraHal: Adjust FD callbacks to updated javadoc
FD callback behavior is updated in latest javadoc
patch "Improve camera face detection javadoc."
Change-Id: I963628ae55eec62083c25d34bbb380ae6673e431
Signed-off-by: Tyler Luu <tluu@ti.com>
-rw-r--r-- | camera/CameraHal.cpp | 6 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCameraAdapter.cpp | 3 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXCapture.cpp | 7 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXFD.cpp | 10 | ||||
-rw-r--r-- | camera/OMXCameraAdapter/OMXFocus.cpp | 9 | ||||
-rw-r--r-- | camera/inc/OMXCameraAdapter/OMXCameraAdapter.h | 2 |
6 files changed, 36 insertions, 1 deletions
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index d96229a..43478b5 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -3127,7 +3127,13 @@ void CameraHal::forceStopPreview() } if ( NULL != mCameraAdapter ) { + // according to javadoc...FD should be stopped in stopPreview + // and application needs to call startFaceDection again + // to restart FD + mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_FD); + cancelAutoFocus(); + //Stop the source of frames mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_PREVIEW); } diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp index 131072c..493adce 100644 --- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp +++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp @@ -315,6 +315,7 @@ status_t OMXCameraAdapter::initialize(CameraProperties::Properties* caps, int se memset(mExposureBracketingValues, 0, EXP_BRACKET_RANGE*sizeof(int)); mMeasurementEnabled = false; mFaceDetectionRunning = false; + mFaceDetectionPaused = false; memset(&mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mImagePortIndex], 0, sizeof(OMXCameraPortParameters)); memset(&mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mPrevPortIndex], 0, sizeof(OMXCameraPortParameters)); @@ -2663,7 +2664,7 @@ OMX_ERRORTYPE OMXCameraAdapter::OMXCameraAdapterFillBufferDone(OMX_IN OMX_HANDLE { Mutex::Autolock lock(mFaceDetectionLock); - if ( mFaceDetectionRunning ) { + if ( mFaceDetectionRunning && !mFaceDetectionPaused ) { detectFaces(pBuffHeader, fdResult, pPortParam->mWidth, pPortParam->mHeight); if ( NULL != fdResult.get() ) { notifyFaceSubscribers(fdResult); diff --git a/camera/OMXCameraAdapter/OMXCapture.cpp b/camera/OMXCameraAdapter/OMXCapture.cpp index 079a072..f6e26c9 100644 --- a/camera/OMXCameraAdapter/OMXCapture.cpp +++ b/camera/OMXCameraAdapter/OMXCapture.cpp @@ -701,6 +701,9 @@ status_t OMXCameraAdapter::startImageCapture() return NO_INIT; } + // Camera framework doesn't expect face callbacks once capture is triggered + pauseFaceDetection(true); + //During bracketing image capture is already active { Mutex::Autolock lock(mBracketingLock); @@ -850,6 +853,10 @@ status_t OMXCameraAdapter::stopImageCapture() CAMHAL_LOGEB("Error Releaseing 3A locks%d", ret); } + // After capture, face detection should be disabled + // and application needs to restart face detection + stopFaceDetection(); + //Wait here for the capture to be done, in worst case timeout and proceed with cleanup ret = mCaptureSem.WaitTimeout(OMX_CAPTURE_TIMEOUT); if ( NO_ERROR != ret ) { diff --git a/camera/OMXCameraAdapter/OMXFD.cpp b/camera/OMXCameraAdapter/OMXFD.cpp index e480279..2aab741 100644 --- a/camera/OMXCameraAdapter/OMXFD.cpp +++ b/camera/OMXCameraAdapter/OMXFD.cpp @@ -54,6 +54,15 @@ status_t OMXCameraAdapter::stopFaceDetection() return setFaceDetection(false, mDeviceOrientation); } +void OMXCameraAdapter::pauseFaceDetection(bool pause) +{ + Mutex::Autolock lock(mFaceDetectionLock); + // pausing will only take affect if fd is already running + if (mFaceDetectionRunning) { + mFaceDetectionPaused = pause; + } +} + status_t OMXCameraAdapter::setFaceDetection(bool enable, OMX_U32 orientation) { status_t ret = NO_ERROR; @@ -134,6 +143,7 @@ status_t OMXCameraAdapter::setFaceDetection(bool enable, OMX_U32 orientation) if ( NO_ERROR == ret ) { mFaceDetectionRunning = enable; + mFaceDetectionPaused = !enable; } LOG_FUNCTION_NAME_EXIT; diff --git a/camera/OMXCameraAdapter/OMXFocus.cpp b/camera/OMXCameraAdapter/OMXFocus.cpp index df1031a..939fb04 100644 --- a/camera/OMXCameraAdapter/OMXFocus.cpp +++ b/camera/OMXCameraAdapter/OMXFocus.cpp @@ -85,6 +85,9 @@ status_t OMXCameraAdapter::doAutoFocus() return NO_INIT; } + // If the app calls autoFocus, the camera will stop sending face callbacks. + pauseFaceDetection(true); + if ( NO_ERROR == ret ) { if ( !mFocusAreas.isEmpty() ) @@ -288,6 +291,9 @@ status_t OMXCameraAdapter::cancelAutoFocus() OMX_IndexConfigCommonFocusStatus, NULL ); + // If the apps call #cancelAutoFocus()}, the face callbacks will also resume. + pauseFaceDetection(false); + LOG_FUNCTION_NAME_EXIT; return ret; @@ -437,6 +443,9 @@ status_t OMXCameraAdapter::returnFocusStatus(bool timeoutReached) notifyFocusSubscribers(focusStatus); } + // After focus, face detection will resume sending face callbacks + pauseFaceDetection(false); + LOG_FUNCTION_NAME_EXIT; return ret; diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h index 42d7d11..b8cebe7 100644 --- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h +++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h @@ -506,6 +506,7 @@ private: camera_frame_metadata_t **pFaces, size_t previewWidth, size_t previewHeight); + void pauseFaceDetection(bool pause); //3A Algorithms priority configuration status_t setAlgoPriority(AlgoPriority priority, Algorithm3A algo, bool enable); @@ -727,6 +728,7 @@ private: mutable Mutex mFaceDetectionLock; //Face detection status bool mFaceDetectionRunning; + bool mFaceDetectionPaused; //Geo-tagging EXIFData mEXIFData; |