Loading services/camera/libcameraservice/camera2/CaptureSequencer.cpp +31 −15 Original line number Diff line number Diff line Loading @@ -96,11 +96,13 @@ void CaptureSequencer::onFrameAvailable(int32_t frameId, } } void CaptureSequencer::onCaptureAvailable(nsecs_t timestamp) { void CaptureSequencer::onCaptureAvailable(nsecs_t timestamp, sp<MemoryBase> captureBuffer) { ATRACE_CALL(); ALOGV("%s", __FUNCTION__); Mutex::Autolock l(mInputMutex); mCaptureTimestamp = timestamp; mCaptureBuffer = captureBuffer; if (!mNewCaptureReceived) { mNewCaptureReceived = true; mNewCaptureSignal.signal(); Loading Loading @@ -195,7 +197,7 @@ CaptureSequencer::CaptureState CaptureSequencer::manageIdle(sp<Camera2Client> &c } CaptureSequencer::CaptureState CaptureSequencer::manageDone(sp<Camera2Client> &client) { status_t res; status_t res = OK; ATRACE_CALL(); mCaptureId++; Loading @@ -204,6 +206,7 @@ CaptureSequencer::CaptureState CaptureSequencer::manageDone(sp<Camera2Client> &c mBusy = false; } { SharedParameters::Lock l(client->getParameters()); switch (l.mParameters.state) { case Parameters::STILL_CAPTURE: Loading @@ -217,7 +220,20 @@ CaptureSequencer::CaptureState CaptureSequencer::manageDone(sp<Camera2Client> &c "in state %s!", __FUNCTION__, client->getCameraId(), Parameters::getStateName(l.mParameters.state)); res = INVALID_OPERATION; } } if (mCaptureBuffer != 0 && res == OK) { Camera2Client::SharedCameraClient::Lock l(client->mSharedCameraClient); ALOGV("%s: Sending still image to client", __FUNCTION__); if (l.mCameraClient != 0) { l.mCameraClient->dataCallback(CAMERA_MSG_COMPRESSED_IMAGE, mCaptureBuffer, NULL); } else { ALOGV("%s: No client!", __FUNCTION__); } } mCaptureBuffer.clear(); return IDLE; } Loading services/camera/libcameraservice/camera2/CaptureSequencer.h +4 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #ifndef ANDROID_SERVERS_CAMERA_CAMERA2_CAPTURESEQUENCER_H #define ANDROID_SERVERS_CAMERA_CAMERA2_CAPTURESEQUENCER_H #include <binder/MemoryBase.h> #include <utils/Thread.h> #include <utils/String16.h> #include <utils/Vector.h> Loading Loading @@ -58,8 +59,8 @@ class CaptureSequencer: // Notifications from the frame processor virtual void onFrameAvailable(int32_t frameId, CameraMetadata &frame); // Notifications from the capture processor void onCaptureAvailable(nsecs_t timestamp); // Notifications from the JPEG processor void onCaptureAvailable(nsecs_t timestamp, sp<MemoryBase> captureBuffer); void dump(int fd, const Vector<String16>& args); Loading @@ -85,6 +86,7 @@ class CaptureSequencer: bool mNewCaptureReceived; nsecs_t mCaptureTimestamp; sp<MemoryBase> mCaptureBuffer; Condition mNewCaptureSignal; /** Loading services/camera/libcameraservice/camera2/JpegProcessor.cpp +4 −14 Original line number Diff line number Diff line Loading @@ -230,11 +230,6 @@ status_t JpegProcessor::processNewCapture(sp<Camera2Client> &client) { return OK; } sp<CaptureSequencer> sequencer = mSequencer.promote(); if (sequencer != 0) { sequencer->onCaptureAvailable(imgBuffer.timestamp); } // TODO: Optimize this to avoid memcopy void* captureMemory = mCaptureHeap->mHeap->getBase(); size_t size = mCaptureHeap->mHeap->getSize(); Loading @@ -242,16 +237,11 @@ status_t JpegProcessor::processNewCapture(sp<Camera2Client> &client) { mCaptureConsumer->unlockBuffer(imgBuffer); captureHeap = mCaptureHeap; Camera2Client::SharedCameraClient::Lock l(client->mSharedCameraClient); ALOGV("%s: Sending still image to client", __FUNCTION__); if (l.mCameraClient != 0) { l.mCameraClient->dataCallback(CAMERA_MSG_COMPRESSED_IMAGE, captureHeap->mBuffers[0], NULL); } else { ALOGV("%s: No client!", __FUNCTION__); sp<CaptureSequencer> sequencer = mSequencer.promote(); if (sequencer != 0) { sequencer->onCaptureAvailable(imgBuffer.timestamp, mCaptureHeap->mBuffers[0]); } return OK; } Loading Loading
services/camera/libcameraservice/camera2/CaptureSequencer.cpp +31 −15 Original line number Diff line number Diff line Loading @@ -96,11 +96,13 @@ void CaptureSequencer::onFrameAvailable(int32_t frameId, } } void CaptureSequencer::onCaptureAvailable(nsecs_t timestamp) { void CaptureSequencer::onCaptureAvailable(nsecs_t timestamp, sp<MemoryBase> captureBuffer) { ATRACE_CALL(); ALOGV("%s", __FUNCTION__); Mutex::Autolock l(mInputMutex); mCaptureTimestamp = timestamp; mCaptureBuffer = captureBuffer; if (!mNewCaptureReceived) { mNewCaptureReceived = true; mNewCaptureSignal.signal(); Loading Loading @@ -195,7 +197,7 @@ CaptureSequencer::CaptureState CaptureSequencer::manageIdle(sp<Camera2Client> &c } CaptureSequencer::CaptureState CaptureSequencer::manageDone(sp<Camera2Client> &client) { status_t res; status_t res = OK; ATRACE_CALL(); mCaptureId++; Loading @@ -204,6 +206,7 @@ CaptureSequencer::CaptureState CaptureSequencer::manageDone(sp<Camera2Client> &c mBusy = false; } { SharedParameters::Lock l(client->getParameters()); switch (l.mParameters.state) { case Parameters::STILL_CAPTURE: Loading @@ -217,7 +220,20 @@ CaptureSequencer::CaptureState CaptureSequencer::manageDone(sp<Camera2Client> &c "in state %s!", __FUNCTION__, client->getCameraId(), Parameters::getStateName(l.mParameters.state)); res = INVALID_OPERATION; } } if (mCaptureBuffer != 0 && res == OK) { Camera2Client::SharedCameraClient::Lock l(client->mSharedCameraClient); ALOGV("%s: Sending still image to client", __FUNCTION__); if (l.mCameraClient != 0) { l.mCameraClient->dataCallback(CAMERA_MSG_COMPRESSED_IMAGE, mCaptureBuffer, NULL); } else { ALOGV("%s: No client!", __FUNCTION__); } } mCaptureBuffer.clear(); return IDLE; } Loading
services/camera/libcameraservice/camera2/CaptureSequencer.h +4 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #ifndef ANDROID_SERVERS_CAMERA_CAMERA2_CAPTURESEQUENCER_H #define ANDROID_SERVERS_CAMERA_CAMERA2_CAPTURESEQUENCER_H #include <binder/MemoryBase.h> #include <utils/Thread.h> #include <utils/String16.h> #include <utils/Vector.h> Loading Loading @@ -58,8 +59,8 @@ class CaptureSequencer: // Notifications from the frame processor virtual void onFrameAvailable(int32_t frameId, CameraMetadata &frame); // Notifications from the capture processor void onCaptureAvailable(nsecs_t timestamp); // Notifications from the JPEG processor void onCaptureAvailable(nsecs_t timestamp, sp<MemoryBase> captureBuffer); void dump(int fd, const Vector<String16>& args); Loading @@ -85,6 +86,7 @@ class CaptureSequencer: bool mNewCaptureReceived; nsecs_t mCaptureTimestamp; sp<MemoryBase> mCaptureBuffer; Condition mNewCaptureSignal; /** Loading
services/camera/libcameraservice/camera2/JpegProcessor.cpp +4 −14 Original line number Diff line number Diff line Loading @@ -230,11 +230,6 @@ status_t JpegProcessor::processNewCapture(sp<Camera2Client> &client) { return OK; } sp<CaptureSequencer> sequencer = mSequencer.promote(); if (sequencer != 0) { sequencer->onCaptureAvailable(imgBuffer.timestamp); } // TODO: Optimize this to avoid memcopy void* captureMemory = mCaptureHeap->mHeap->getBase(); size_t size = mCaptureHeap->mHeap->getSize(); Loading @@ -242,16 +237,11 @@ status_t JpegProcessor::processNewCapture(sp<Camera2Client> &client) { mCaptureConsumer->unlockBuffer(imgBuffer); captureHeap = mCaptureHeap; Camera2Client::SharedCameraClient::Lock l(client->mSharedCameraClient); ALOGV("%s: Sending still image to client", __FUNCTION__); if (l.mCameraClient != 0) { l.mCameraClient->dataCallback(CAMERA_MSG_COMPRESSED_IMAGE, captureHeap->mBuffers[0], NULL); } else { ALOGV("%s: No client!", __FUNCTION__); sp<CaptureSequencer> sequencer = mSequencer.promote(); if (sequencer != 0) { sequencer->onCaptureAvailable(imgBuffer.timestamp, mCaptureHeap->mBuffers[0]); } return OK; } Loading