summaryrefslogtreecommitdiffstats
path: root/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'camera/OMXCameraAdapter/OMXCameraAdapter.cpp')
-rwxr-xr-xcamera/OMXCameraAdapter/OMXCameraAdapter.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
index b5f156e..eb77c07 100755
--- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
+++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
@@ -1746,6 +1746,8 @@ status_t OMXCameraAdapter::UseBuffersPreview(void* bufArr, int num)
///If there is any failure, we reach here.
///Here, we do any resource freeing and convert from OMX error code to Camera Hal error code
EXIT:
+ mStateSwitchLock.unlock();
+
CAMHAL_LOGEB("Exiting function %s because of ret %d eError=%x", __FUNCTION__, ret, eError);
performCleanupAfterError();
CAMHAL_LOGEB("Exiting function %s because of ret %d eError=%x", __FUNCTION__, ret, eError);
@@ -1767,8 +1769,8 @@ status_t OMXCameraAdapter::startPreview()
if( 0 != mStartPreviewSem.Count() )
{
CAMHAL_LOGEB("Error mStartPreviewSem semaphore count %d", mStartPreviewSem.Count());
- LOG_FUNCTION_NAME_EXIT;
- return NO_INIT;
+ ret = NO_INIT;
+ goto EXIT;
}
mPreviewData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mPrevPortIndex];
@@ -1929,6 +1931,14 @@ status_t OMXCameraAdapter::stopPreview()
mCaptureData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mImagePortIndex];
measurementData = &mCameraAdapterParameters.mCameraPortParams[mCameraAdapterParameters.mMeasurementPortIndex];
+ if (mAdapterState == LOADED_PREVIEW_STATE) {
+ // Something happened in CameraHal between UseBuffers and startPreview
+ // this means that state switch is still locked..so we need to unlock else
+ // deadlock will occur on the next start preview
+ mStateSwitchLock.unlock();
+ return NO_ERROR;
+ }
+
if ( mComponentState != OMX_StateExecuting )
{
CAMHAL_LOGEA("Calling StopPreview() when not in EXECUTING state");