Loading services/camera/libcameraservice/api1/client2/JpegProcessor.cpp +44 −35 Original line number Diff line number Diff line Loading @@ -200,9 +200,17 @@ status_t JpegProcessor::processNewCapture() { ATRACE_CALL(); status_t res; sp<Camera2Heap> captureHeap; sp<MemoryBase> captureBuffer; CpuConsumer::LockedBuffer imgBuffer; { Mutex::Autolock l(mInputMutex); if (mCaptureStreamId == NO_STREAM) { ALOGW("%s: Camera %d: No stream is available", __FUNCTION__, mId); return INVALID_OPERATION; } res = mCaptureConsumer->lockNextBuffer(&imgBuffer); if (res != OK) { if (res != BAD_VALUE) { Loading Loading @@ -239,11 +247,12 @@ status_t JpegProcessor::processNewCapture() { } // TODO: Optimize this to avoid memcopy sp<MemoryBase> captureBuffer = new MemoryBase(mCaptureHeap, 0, jpegSize); captureBuffer = new MemoryBase(mCaptureHeap, 0, jpegSize); void* captureMemory = mCaptureHeap->getBase(); memcpy(captureMemory, imgBuffer.data, jpegSize); mCaptureConsumer->unlockBuffer(imgBuffer); } sp<CaptureSequencer> sequencer = mSequencer.promote(); if (sequencer != 0) { Loading Loading
services/camera/libcameraservice/api1/client2/JpegProcessor.cpp +44 −35 Original line number Diff line number Diff line Loading @@ -200,9 +200,17 @@ status_t JpegProcessor::processNewCapture() { ATRACE_CALL(); status_t res; sp<Camera2Heap> captureHeap; sp<MemoryBase> captureBuffer; CpuConsumer::LockedBuffer imgBuffer; { Mutex::Autolock l(mInputMutex); if (mCaptureStreamId == NO_STREAM) { ALOGW("%s: Camera %d: No stream is available", __FUNCTION__, mId); return INVALID_OPERATION; } res = mCaptureConsumer->lockNextBuffer(&imgBuffer); if (res != OK) { if (res != BAD_VALUE) { Loading Loading @@ -239,11 +247,12 @@ status_t JpegProcessor::processNewCapture() { } // TODO: Optimize this to avoid memcopy sp<MemoryBase> captureBuffer = new MemoryBase(mCaptureHeap, 0, jpegSize); captureBuffer = new MemoryBase(mCaptureHeap, 0, jpegSize); void* captureMemory = mCaptureHeap->getBase(); memcpy(captureMemory, imgBuffer.data, jpegSize); mCaptureConsumer->unlockBuffer(imgBuffer); } sp<CaptureSequencer> sequencer = mSequencer.promote(); if (sequencer != 0) { Loading