summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2011-11-07 21:46:57 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-07 21:46:57 +0000
commite07582bc653030bdfd7957f148d9ab8baf28f1ba (patch)
tree4acffd31d2956fe41308aeb742138faa22df29c0 /camera
parentacaf7ec3fa398eea77ad207d71b5453f2227aa00 (diff)
parent3c86a5424fa4a0099d66172ff8b0a00eda9fd528 (diff)
downloadhardware_ti_omap4xxx-e07582bc653030bdfd7957f148d9ab8baf28f1ba.zip
hardware_ti_omap4xxx-e07582bc653030bdfd7957f148d9ab8baf28f1ba.tar.gz
hardware_ti_omap4xxx-e07582bc653030bdfd7957f148d9ab8baf28f1ba.tar.bz2
am 3c86a542: am fe3c9139: CameraHal: Wait for frame before stopping preview
* commit '3c86a5424fa4a0099d66172ff8b0a00eda9fd528': CameraHal: Wait for frame before stopping preview
Diffstat (limited to 'camera')
-rwxr-xr-xcamera/OMXCameraAdapter/OMXCameraAdapter.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
index 2bc40d0..2cec0c3 100755
--- a/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
+++ b/camera/OMXCameraAdapter/OMXCameraAdapter.cpp
@@ -1942,6 +1942,20 @@ status_t OMXCameraAdapter::stopPreview()
{
Mutex::Autolock lock(mFrameCountMutex);
+ // we should wait for the first frame to come before trying to stopPreview...if not
+ // we might put OMXCamera in a bad state (IDLE->LOADED timeout). Seeing this a lot
+ // after a capture
+ if (mFrameCount < 1) {
+ // I want to wait for at least two frames....
+ mFrameCount = -1;
+
+ // first frame may time some time to come...so wait for an adequate amount of time
+ // which 2 * OMX_CAPTURE_TIMEOUT * 1000 will cover.
+ ret = mFirstFrameCondition.waitRelative(mFrameCountMutex,
+ (nsecs_t) 2 * OMX_CAPTURE_TIMEOUT * 1000);
+ }
+ // even if we timeout waiting for the first frame...go ahead with trying to stop preview
+ // signal anybody that might be waiting
mFrameCount = 0;
mFirstFrameCondition.broadcast();
}