From 1e6ccd5c78016ac9f9247cb8337cf263b3afb73e Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Sun, 7 Oct 2012 22:43:48 -0700 Subject: Camera2: Move non-ZSL shutter sound firing to be later. Instead of firing shutter sound when capture request is submitted for non-ZSL captures, fire it when the metadata frame is received. This guarantees that the shutter sound fires after picture capture is completed by the sensor. Bug: 7259900 Change-Id: I4a1eeed89ed0400bf80b0f0cc2d5799c3d9bb9e3 --- .../camera/libcameraservice/camera2/CaptureSequencer.cpp | 15 ++++++++++----- .../camera/libcameraservice/camera2/CaptureSequencer.h | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'services/camera') diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp index 5156539..fe4abc0 100644 --- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp +++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp @@ -40,6 +40,7 @@ CaptureSequencer::CaptureSequencer(wp client): mNewAEState(false), mNewFrameReceived(false), mNewCaptureReceived(false), + mShutterNotified(false), mClient(client), mCaptureState(IDLE), mTriggerId(0), @@ -308,6 +309,7 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStart( } else { nextState = STANDARD_START; } + mShutterNotified = false; return nextState; } @@ -342,7 +344,7 @@ CaptureSequencer::CaptureState CaptureSequencer::manageZslStart( SharedParameters::Lock l(client->getParameters()); /* warning: this also locks a SharedCameraClient */ shutterNotifyLocked(l.mParameters, client); - + mShutterNotified = true; mTimeoutCount = kMaxTimeoutsForCaptureEnd; return STANDARD_CAPTURE_WAIT; } @@ -474,9 +476,6 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCapture( return DONE; } - /* warning: this also locks a SharedCameraClient */ - shutterNotifyLocked(l.mParameters, client); - mTimeoutCount = kMaxTimeoutsForCaptureEnd; return STANDARD_CAPTURE_WAIT; } @@ -493,7 +492,13 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCaptureWait( break; } } - while (!mNewCaptureReceived) { + if (mNewFrameReceived && !mShutterNotified) { + SharedParameters::Lock l(client->getParameters()); + /* warning: this also locks a SharedCameraClient */ + shutterNotifyLocked(l.mParameters, client); + mShutterNotified = true; + } + while (mNewFrameReceived && !mNewCaptureReceived) { res = mNewCaptureSignal.waitRelative(mInputMutex, kWaitDuration); if (res == TIMED_OUT) { mTimeoutCount--; diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.h b/services/camera/libcameraservice/camera2/CaptureSequencer.h index 8df6d95..4cde9c8 100644 --- a/services/camera/libcameraservice/camera2/CaptureSequencer.h +++ b/services/camera/libcameraservice/camera2/CaptureSequencer.h @@ -94,6 +94,8 @@ class CaptureSequencer: sp mCaptureBuffer; Condition mNewCaptureSignal; + bool mShutterNotified; + /** * Internal to CaptureSequencer */ -- cgit v1.1