Loading services/camera/libcameraservice/common/FrameProcessorBase.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -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() { Loading Loading @@ -113,6 +120,7 @@ void FrameProcessorBase::processNewFrames(const sp<CameraDeviceBase> &device) { } if (!frame.isEmpty()) { Mutex::Autolock al(mLastFrameMutex); mLastFrame.acquire(frame); } } Loading services/camera/libcameraservice/common/FrameProcessorBase.h +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class FrameProcessorBase: public Thread { virtual bool threadLoop(); Mutex mInputMutex; Mutex mLastFrameMutex; struct RangeListener { int32_t minId; Loading Loading
services/camera/libcameraservice/common/FrameProcessorBase.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -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() { Loading Loading @@ -113,6 +120,7 @@ void FrameProcessorBase::processNewFrames(const sp<CameraDeviceBase> &device) { } if (!frame.isEmpty()) { Mutex::Autolock al(mLastFrameMutex); mLastFrame.acquire(frame); } } Loading
services/camera/libcameraservice/common/FrameProcessorBase.h +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ class FrameProcessorBase: public Thread { virtual bool threadLoop(); Mutex mInputMutex; Mutex mLastFrameMutex; struct RangeListener { int32_t minId; Loading