diff options
author | Igor Murashkin <iam@google.com> | 2013-10-08 22:57:32 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-08 22:57:32 +0000 |
commit | 828363dada5878fca6e0cb1553fbea96f38671c8 (patch) | |
tree | 608bb4956dad2e8582fb874c350d40f7d3367cb9 /services/camera/libcameraservice | |
parent | a676e96c6ed71846bdf60448bd63100ee2b357fb (diff) | |
parent | 215bb3499c7eeea6303e55fac66452f2574c022a (diff) | |
download | frameworks_av-828363dada5878fca6e0cb1553fbea96f38671c8.zip frameworks_av-828363dada5878fca6e0cb1553fbea96f38671c8.tar.gz frameworks_av-828363dada5878fca6e0cb1553fbea96f38671c8.tar.bz2 |
Merge "camera2: Don't race while dumping last frame metadata" into klp-dev
Diffstat (limited to 'services/camera/libcameraservice')
-rw-r--r-- | services/camera/libcameraservice/common/FrameProcessorBase.cpp | 10 | ||||
-rw-r--r-- | services/camera/libcameraservice/common/FrameProcessorBase.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/common/FrameProcessorBase.cpp b/services/camera/libcameraservice/common/FrameProcessorBase.cpp index e7b440a..52906ee 100644 --- a/services/camera/libcameraservice/common/FrameProcessorBase.cpp +++ b/services/camera/libcameraservice/common/FrameProcessorBase.cpp @@ -66,7 +66,14 @@ status_t FrameProcessorBase::removeListener(int32_t minId, void FrameProcessorBase::dump(int fd, const Vector<String16>& /*args*/) { String8 result(" Latest received frame:\n"); write(fd, result.string(), result.size()); - mLastFrame.dump(fd, 2, 6); + + CameraMetadata lastFrame; + { + // Don't race while dumping metadata + Mutex::Autolock al(mLastFrameMutex); + lastFrame = CameraMetadata(mLastFrame); + } + lastFrame.dump(fd, 2, 6); } bool FrameProcessorBase::threadLoop() { @@ -113,6 +120,7 @@ void FrameProcessorBase::processNewFrames(const sp<CameraDeviceBase> &device) { } if (!frame.isEmpty()) { + Mutex::Autolock al(mLastFrameMutex); mLastFrame.acquire(frame); } } diff --git a/services/camera/libcameraservice/common/FrameProcessorBase.h b/services/camera/libcameraservice/common/FrameProcessorBase.h index f96caff..4d80ebf 100644 --- a/services/camera/libcameraservice/common/FrameProcessorBase.h +++ b/services/camera/libcameraservice/common/FrameProcessorBase.h @@ -58,6 +58,7 @@ class FrameProcessorBase: public Thread { virtual bool threadLoop(); Mutex mInputMutex; + Mutex mLastFrameMutex; struct RangeListener { int32_t minId; |