summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2012-09-20 15:12:24 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-20 15:12:25 -0700
commit4386b7c4b0f24aa634c0e33f69565bbaa1b2e072 (patch)
tree97869f34cd8ffb0420fc4564b72ed64c51a772f7 /services
parentaa05a277e317ff224229c741bb97a6351d3c17db (diff)
parent768cf093dade9085e0ad6305d9f7c16ae9ad9e26 (diff)
downloadframeworks_av-4386b7c4b0f24aa634c0e33f69565bbaa1b2e072.zip
frameworks_av-4386b7c4b0f24aa634c0e33f69565bbaa1b2e072.tar.gz
frameworks_av-4386b7c4b0f24aa634c0e33f69565bbaa1b2e072.tar.bz2
Merge "Camera2: Erase ZSL queue after each use." into jb-mr1-dev
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/camera2/CaptureSequencer.cpp5
-rw-r--r--services/camera/libcameraservice/camera2/ZslProcessor.cpp25
-rw-r--r--services/camera/libcameraservice/camera2/ZslProcessor.h3
3 files changed, 32 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
index 941ad15..a836321 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
@@ -223,6 +223,11 @@ CaptureSequencer::CaptureState CaptureSequencer::manageDone(sp<Camera2Client> &c
res = INVALID_OPERATION;
}
}
+ sp<ZslProcessor> processor = mZslProcessor.promote();
+ if (processor != 0) {
+ processor->clearZslQueue();
+ }
+
if (mCaptureBuffer != 0 && res == OK) {
Camera2Client::SharedCameraClient::Lock l(client->mSharedCameraClient);
ALOGV("%s: Sending still image to client", __FUNCTION__);
diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.cpp b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
index 8906cd7..c7a679e 100644
--- a/services/camera/libcameraservice/camera2/ZslProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
@@ -97,6 +97,10 @@ void ZslProcessor::onBufferReleased(buffer_handle_t *handle) {
__FUNCTION__, handle);
}
+ // Erase entire ZSL queue since we've now completed the capture and preview
+ // is stopped.
+ clearZslQueueLocked();
+
mState = RUNNING;
}
@@ -240,7 +244,6 @@ status_t ZslProcessor::pushToReprocess(int32_t requestId) {
dumpZslQueue(-1);
}
-
if (mZslQueueTail != mZslQueueHead) {
CameraMetadata request;
size_t index = mZslQueueTail;
@@ -312,6 +315,26 @@ status_t ZslProcessor::pushToReprocess(int32_t requestId) {
return OK;
}
+status_t ZslProcessor::clearZslQueue() {
+ Mutex::Autolock l(mInputMutex);
+ // If in middle of capture, can't clear out queue
+ if (mState == LOCKED) return OK;
+
+ return clearZslQueueLocked();
+}
+
+status_t ZslProcessor::clearZslQueueLocked() {
+ for (size_t i = 0; i < mZslQueue.size(); i++) {
+ if (mZslQueue[i].buffer.mTimestamp != 0) {
+ mZslConsumer->releaseBuffer(mZslQueue[i].buffer);
+ }
+ mZslQueue.replaceAt(i);
+ }
+ mZslQueueHead = 0;
+ mZslQueueTail = 0;
+ return OK;
+}
+
void ZslProcessor::dump(int fd, const Vector<String16>& args) const {
Mutex::Autolock l(mInputMutex);
dumpZslQueue(fd);
diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.h b/services/camera/libcameraservice/camera2/ZslProcessor.h
index 268f4f5..96ad5fb 100644
--- a/services/camera/libcameraservice/camera2/ZslProcessor.h
+++ b/services/camera/libcameraservice/camera2/ZslProcessor.h
@@ -62,6 +62,7 @@ class ZslProcessor:
int getReprocessStreamId() const;
status_t pushToReprocess(int32_t requestId);
+ status_t clearZslQueue();
void dump(int fd, const Vector<String16>& args) const;
private:
@@ -111,6 +112,8 @@ class ZslProcessor:
// Match up entries from frame list to buffers in ZSL queue
void findMatchesLocked();
+ status_t clearZslQueueLocked();
+
void dumpZslQueue(int id) const;
};