summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/common/FrameProcessorBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/camera/libcameraservice/common/FrameProcessorBase.cpp')
-rw-r--r--services/camera/libcameraservice/common/FrameProcessorBase.cpp10
1 files changed, 9 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);
}
}