From 88006b1ebee79cb0f1a2c682258b313eb801049d Mon Sep 17 00:00:00 2001 From: Sundar Raman Date: Thu, 29 Sep 2011 17:54:31 -0700 Subject: omap4xxx: camera: various fixes clean up resources properly on exit: - Frees all resources in case of error during preview buffer allocation in ANativeDisplayAdadapter. - Fixes a couple of typos in BaseCameraAdapter. - Removes a possible memory leak during temporal bracketing. 'stopBracketing()' will never get properly executed when 'startImageCapture()' disables 'mBracketingEnabled'. - Stops temporal bracketing properly inside 'signalEndImageCapture()'. Change-Id: Ic122058c835e30f12f335a288164475b8f6d1c6d Signed-off-by: Emilian Peev Signed-off-by: Sundar Raman Signed-off-by: Iliyan Malchev --- camera/CameraHal.cpp | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'camera/CameraHal.cpp') diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 8556a31..ee8267c 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -1301,7 +1301,11 @@ status_t CameraHal::signalEndImageCapture() LOG_FUNCTION_NAME; - mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_IMAGE_CAPTURE); + if ( mBracketingRunning ) { + stopImageBracketing(); + } else { + mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_IMAGE_CAPTURE); + } LOG_FUNCTION_NAME_EXIT; @@ -2378,25 +2382,14 @@ status_t CameraHal::stopImageBracketing() LOG_FUNCTION_NAME; - if ( !mBracketingRunning ) - { - return ret; - } - - if ( NO_ERROR == ret ) - { - mBracketingRunning = false; - } - - if(!previewEnabled() && !mDisplayPaused) + if( !previewEnabled() ) { return NO_INIT; } - if ( NO_ERROR == ret ) - { - ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_BRACKET_CAPTURE); - } + mBracketingRunning = false; + + ret = mCameraAdapter->sendCommand(CameraAdapter::CAMERA_STOP_BRACKET_CAPTURE); LOG_FUNCTION_NAME_EXIT; @@ -2550,10 +2543,6 @@ status_t CameraHal::takePicture( ) ( int ) &desc); } } - else - { - mBracketingRunning = false; - } if ( ( NO_ERROR == ret ) && ( NULL != mCameraAdapter ) ) { -- cgit v1.1