summaryrefslogtreecommitdiffstats
path: root/camera/OMXCameraAdapter
diff options
context:
space:
mode:
authorDaniel Levin <dendy@ti.com>2012-07-25 16:54:03 -0500
committerDaniel Levin <dendy@ti.com>2012-07-25 16:54:03 -0500
commit13269a9cde9eaf913ad18d1efa6709032d473529 (patch)
tree7f0bdb68fd3eb47f0293a9cc034498f5c560e80d /camera/OMXCameraAdapter
parent1a7ad0061380805c8c8197cc9d9b6a875840f086 (diff)
parent528583d223bc151529deae18ba6e7f102e0810ba (diff)
downloadhardware_ti_omap4-13269a9cde9eaf913ad18d1efa6709032d473529.zip
hardware_ti_omap4-13269a9cde9eaf913ad18d1efa6709032d473529.tar.gz
hardware_ti_omap4-13269a9cde9eaf913ad18d1efa6709032d473529.tar.bz2
Merge "camera: fix deadlock because of mStateSwitchLock" into jb-migration
Change-Id: I30238b6ff0a7cbab7a4908b88e1ca1be3ac3a89c Signed-off-by: Daniel Levin <dendy@ti.com>
Diffstat (limited to 'camera/OMXCameraAdapter')
-rw-r--r--camera/OMXCameraAdapter/OMXCameraAdapter.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
index f2c1129..710c16a 100644
--- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
+++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
@@ -2295,6 +2295,14 @@ status_t OMXCameraAdapter::destroyTunnel()
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 ALREADY_EXISTS;
+ }
+
if ( mComponentState != OMX_StateExecuting )
{
CAMHAL_LOGEA("Calling StopPreview() when not in EXECUTING state");
@@ -2394,6 +2402,10 @@ status_t OMXCameraAdapter::stopPreview() {
if (mTunnelDestroyed == false){
ret = destroyTunnel();
+ if (ret == ALREADY_EXISTS) {
+ // Special case to handle invalid stopping preview in LOADED_PREVIEW_STATE
+ return NO_ERROR;
+ }
if (ret != NO_ERROR) {
CAMHAL_LOGEB(" destroyTunnel returned error ");
return ret;