summaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2012-10-07 22:43:48 -0700
committerEino-Ville Talvala <etalvala@google.com>2012-10-08 16:47:14 -0700
commit1e6ccd5c78016ac9f9247cb8337cf263b3afb73e (patch)
treec0626bdaf92c4f27acfe7d8bd33cdd7e0affab9f /services
parent82edd5431951f461058c07b73c0dbc093aa45c99 (diff)
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
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/camera2/CaptureSequencer.cpp15
-rw-r--r--services/camera/libcameraservice/camera2/CaptureSequencer.h2
2 files changed, 12 insertions, 5 deletions
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
index 5156539b..fe4abc0e 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
@@ -40,6 +40,7 @@ CaptureSequencer::CaptureSequencer(wp<Camera2Client> 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 8df6d95d..4cde9c83 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.h
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.h
@@ -94,6 +94,8 @@ class CaptureSequencer:
sp<MemoryBase> mCaptureBuffer;
Condition mNewCaptureSignal;
+ bool mShutterNotified;
+
/**
* Internal to CaptureSequencer
*/