From 2facbeb345500d62f74eac01ebb49a069fe034c1 Mon Sep 17 00:00:00 2001 From: Raji Reddy Kandi Date: Thu, 20 Oct 2011 00:20:28 +0530 Subject: CameraHAL: protect mParameters3A from simultaneous read/write. Fix for Issue: Idle -> remove from the latest launched apps -> Launch Camera -> Settings -> Restore defaults -> ok -> Flash mode On -> White balance Cloudy -> Exposure -3 -> Scene mode Party -> Shooting -> Camcoder mode -> Settings -> Restore defaults -> ok ==> video preview is red even after we restored the settings. Change-Id: If4b3672693a092f1956708742a6cc5f2c2c284fb Signed-off-by: Raji Reddy Kandi --- camera/OMXCameraAdapter/OMX3A.cpp | 9 +++++++++ camera/inc/OMXCameraAdapter/OMXCameraAdapter.h | 1 + 2 files changed, 10 insertions(+) diff --git a/camera/OMXCameraAdapter/OMX3A.cpp b/camera/OMXCameraAdapter/OMX3A.cpp index 5078fd7..6c8d85f 100644 --- a/camera/OMXCameraAdapter/OMX3A.cpp +++ b/camera/OMXCameraAdapter/OMX3A.cpp @@ -49,6 +49,8 @@ status_t OMXCameraAdapter::setParameters3A(const CameraParameters ¶ms, LOG_FUNCTION_NAME; + Mutex::Autolock lock(m3ASettingsUpdateLock); + str = params.get(CameraParameters::KEY_SCENE_MODE); mode = getLUTvalue_HALtoOMX( str, SceneLUT); if ( mFirstTimeInit || ((str != NULL) && ( mParameters3A.SceneMode != mode )) ) { @@ -1512,6 +1514,10 @@ status_t OMXCameraAdapter::apply3Asettings( Gen3A_settings& Gen3A ) unsigned int currSett; // 32 bit int portIndex; + LOG_FUNCTION_NAME; + + Mutex::Autolock lock(m3ASettingsUpdateLock); + /* * Scenes have a priority during the process * of applying 3A related parameters. @@ -1637,6 +1643,9 @@ status_t OMXCameraAdapter::apply3Asettings( Gen3A_settings& Gen3A ) mPending3Asettings &= ~currSett; } } + + LOG_FUNCTION_NAME_EXIT; + return ret; } diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h index 8418ff4..04bc64c 100644 --- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h +++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h @@ -834,6 +834,7 @@ private: OMX_VERSIONTYPE mLocalVersionParam; unsigned int mPending3Asettings; + Mutex m3ASettingsUpdateLock; Gen3A_settings mParameters3A; OMX_TI_CONFIG_3A_FACE_PRIORITY mFacePriority; -- cgit v1.1