summaryrefslogtreecommitdiffstats
path: root/services/camera
diff options
context:
space:
mode:
authorZhijun He <zhijunhe@google.com>2013-05-24 15:32:48 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-05-24 15:32:48 +0000
commit6f6b31da6097f1d770137ebadac5023dd8b79413 (patch)
tree11c5a6996814abec2a3be7312a6aa626a1610f98 /services/camera
parent6947f125f76dde6664779126415d11b3365225da (diff)
parent124ccf4b5023a40c57b49981123e6c9b61408a5d (diff)
downloadframeworks_av-6f6b31da6097f1d770137ebadac5023dd8b79413.zip
frameworks_av-6f6b31da6097f1d770137ebadac5023dd8b79413.tar.gz
frameworks_av-6f6b31da6097f1d770137ebadac5023dd8b79413.tar.bz2
Merge "Camera3: Fix the deadlock during recording pinch zooming" into jb-mr2-dev
Diffstat (limited to 'services/camera')
-rw-r--r--services/camera/libcameraservice/camera3/Camera3OutputStream.cpp15
-rw-r--r--services/camera/libcameraservice/camera3/Camera3OutputStream.h3
2 files changed, 15 insertions, 3 deletions
diff --git a/services/camera/libcameraservice/camera3/Camera3OutputStream.cpp b/services/camera/libcameraservice/camera3/Camera3OutputStream.cpp
index a2c97d4..2efeede 100644
--- a/services/camera/libcameraservice/camera3/Camera3OutputStream.cpp
+++ b/services/camera/libcameraservice/camera3/Camera3OutputStream.cpp
@@ -166,11 +166,20 @@ status_t Camera3OutputStream::returnBufferCheckedLocked(
int anwReleaseFence = releaseFence->dup();
/**
+ * Release the lock briefly to avoid deadlock with
+ * StreamingProcessor::startStream -> Camera3Stream::isConfiguring (this
+ * thread will go into StreamingProcessor::onFrameAvailable) during
+ * queueBuffer
+ */
+ sp<ANativeWindow> currentConsumer = mConsumer;
+ mLock.unlock();
+
+ /**
* Return buffer back to ANativeWindow
*/
if (buffer.status == CAMERA3_BUFFER_STATUS_ERROR) {
// Cancel buffer
- res = mConsumer->cancelBuffer(mConsumer.get(),
+ res = currentConsumer->cancelBuffer(currentConsumer.get(),
container_of(buffer.buffer, ANativeWindowBuffer, handle),
anwReleaseFence);
if (res != OK) {
@@ -178,7 +187,7 @@ status_t Camera3OutputStream::returnBufferCheckedLocked(
" %s (%d)", __FUNCTION__, mId, strerror(-res), res);
}
} else {
- res = mConsumer->queueBuffer(mConsumer.get(),
+ res = currentConsumer->queueBuffer(currentConsumer.get(),
container_of(buffer.buffer, ANativeWindowBuffer, handle),
anwReleaseFence);
if (res != OK) {
@@ -186,7 +195,7 @@ status_t Camera3OutputStream::returnBufferCheckedLocked(
"%s (%d)", __FUNCTION__, mId, strerror(-res), res);
}
}
-
+ mLock.lock();
if (res != OK) {
close(anwReleaseFence);
return res;
diff --git a/services/camera/libcameraservice/camera3/Camera3OutputStream.h b/services/camera/libcameraservice/camera3/Camera3OutputStream.h
index ce317f9..774fbdd 100644
--- a/services/camera/libcameraservice/camera3/Camera3OutputStream.h
+++ b/services/camera/libcameraservice/camera3/Camera3OutputStream.h
@@ -66,6 +66,9 @@ class Camera3OutputStream :
Camera3OutputStream(int id, camera3_stream_type_t type,
uint32_t width, uint32_t height, int format);
+ /**
+ * Note that we release the lock briefly in this function
+ */
virtual status_t returnBufferCheckedLocked(
const camera3_stream_buffer &buffer,
nsecs_t timestamp,