Loading services/camera/libcameraservice/Camera2Device.cpp +21 −4 Original line number Original line Diff line number Diff line Loading @@ -302,6 +302,12 @@ status_t Camera2Device::MetadataQueue::setStreamSlot(camera_metadata_t *buf) mStreamSlotCount = 0; mStreamSlotCount = 0; return OK; return OK; } } camera_metadata_t *buf2 = clone_camera_metadata(buf); if (!buf2) { ALOGE("%s: Unable to clone metadata buffer!", __FUNCTION__); return NO_MEMORY; } if (mStreamSlotCount > 1) { if (mStreamSlotCount > 1) { List<camera_metadata_t*>::iterator deleter = ++mStreamSlot.begin(); List<camera_metadata_t*>::iterator deleter = ++mStreamSlot.begin(); freeBuffers(++mStreamSlot.begin(), mStreamSlot.end()); freeBuffers(++mStreamSlot.begin(), mStreamSlot.end()); Loading @@ -309,9 +315,9 @@ status_t Camera2Device::MetadataQueue::setStreamSlot(camera_metadata_t *buf) } } if (mStreamSlotCount == 1) { if (mStreamSlotCount == 1) { free_camera_metadata( *(mStreamSlot.begin()) ); free_camera_metadata( *(mStreamSlot.begin()) ); *(mStreamSlot.begin()) = buf; *(mStreamSlot.begin()) = buf2; } else { } else { mStreamSlot.push_front(buf); mStreamSlot.push_front(buf2); mStreamSlotCount = 1; mStreamSlotCount = 1; } } return signalConsumerLocked(); return signalConsumerLocked(); Loading @@ -322,11 +328,22 @@ status_t Camera2Device::MetadataQueue::setStreamSlot( { { ALOGV("%s: E", __FUNCTION__); ALOGV("%s: E", __FUNCTION__); Mutex::Autolock l(mMutex); Mutex::Autolock l(mMutex); status_t res; if (mStreamSlotCount > 0) { if (mStreamSlotCount > 0) { freeBuffers(mStreamSlot.begin(), mStreamSlot.end()); freeBuffers(mStreamSlot.begin(), mStreamSlot.end()); } } mStreamSlot = bufs; mStreamSlotCount = 0; mStreamSlotCount = mStreamSlot.size(); for (List<camera_metadata_t*>::const_iterator r = bufs.begin(); r != bufs.end(); r++) { camera_metadata_t *r2 = clone_camera_metadata(*r); if (!r2) { ALOGE("%s: Unable to clone metadata buffer!", __FUNCTION__); return NO_MEMORY; } mStreamSlot.push_back(r2); mStreamSlotCount++; } return signalConsumerLocked(); return signalConsumerLocked(); } } Loading services/camera/libcameraservice/Camera2Device.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -87,7 +87,8 @@ class Camera2Device : public virtual RefBase { // Set repeating buffer(s); if the queue is empty on a dequeue call, the // Set repeating buffer(s); if the queue is empty on a dequeue call, the // queue copies the contents of the stream slot into the queue, and then // queue copies the contents of the stream slot into the queue, and then // dequeues the first new entry. // dequeues the first new entry. The metadata buffers passed in are // copied. status_t setStreamSlot(camera_metadata_t *buf); status_t setStreamSlot(camera_metadata_t *buf); status_t setStreamSlot(const List<camera_metadata_t*> &bufs); status_t setStreamSlot(const List<camera_metadata_t*> &bufs); Loading Loading
services/camera/libcameraservice/Camera2Device.cpp +21 −4 Original line number Original line Diff line number Diff line Loading @@ -302,6 +302,12 @@ status_t Camera2Device::MetadataQueue::setStreamSlot(camera_metadata_t *buf) mStreamSlotCount = 0; mStreamSlotCount = 0; return OK; return OK; } } camera_metadata_t *buf2 = clone_camera_metadata(buf); if (!buf2) { ALOGE("%s: Unable to clone metadata buffer!", __FUNCTION__); return NO_MEMORY; } if (mStreamSlotCount > 1) { if (mStreamSlotCount > 1) { List<camera_metadata_t*>::iterator deleter = ++mStreamSlot.begin(); List<camera_metadata_t*>::iterator deleter = ++mStreamSlot.begin(); freeBuffers(++mStreamSlot.begin(), mStreamSlot.end()); freeBuffers(++mStreamSlot.begin(), mStreamSlot.end()); Loading @@ -309,9 +315,9 @@ status_t Camera2Device::MetadataQueue::setStreamSlot(camera_metadata_t *buf) } } if (mStreamSlotCount == 1) { if (mStreamSlotCount == 1) { free_camera_metadata( *(mStreamSlot.begin()) ); free_camera_metadata( *(mStreamSlot.begin()) ); *(mStreamSlot.begin()) = buf; *(mStreamSlot.begin()) = buf2; } else { } else { mStreamSlot.push_front(buf); mStreamSlot.push_front(buf2); mStreamSlotCount = 1; mStreamSlotCount = 1; } } return signalConsumerLocked(); return signalConsumerLocked(); Loading @@ -322,11 +328,22 @@ status_t Camera2Device::MetadataQueue::setStreamSlot( { { ALOGV("%s: E", __FUNCTION__); ALOGV("%s: E", __FUNCTION__); Mutex::Autolock l(mMutex); Mutex::Autolock l(mMutex); status_t res; if (mStreamSlotCount > 0) { if (mStreamSlotCount > 0) { freeBuffers(mStreamSlot.begin(), mStreamSlot.end()); freeBuffers(mStreamSlot.begin(), mStreamSlot.end()); } } mStreamSlot = bufs; mStreamSlotCount = 0; mStreamSlotCount = mStreamSlot.size(); for (List<camera_metadata_t*>::const_iterator r = bufs.begin(); r != bufs.end(); r++) { camera_metadata_t *r2 = clone_camera_metadata(*r); if (!r2) { ALOGE("%s: Unable to clone metadata buffer!", __FUNCTION__); return NO_MEMORY; } mStreamSlot.push_back(r2); mStreamSlotCount++; } return signalConsumerLocked(); return signalConsumerLocked(); } } Loading
services/camera/libcameraservice/Camera2Device.h +2 −1 Original line number Original line Diff line number Diff line Loading @@ -87,7 +87,8 @@ class Camera2Device : public virtual RefBase { // Set repeating buffer(s); if the queue is empty on a dequeue call, the // Set repeating buffer(s); if the queue is empty on a dequeue call, the // queue copies the contents of the stream slot into the queue, and then // queue copies the contents of the stream slot into the queue, and then // dequeues the first new entry. // dequeues the first new entry. The metadata buffers passed in are // copied. status_t setStreamSlot(camera_metadata_t *buf); status_t setStreamSlot(camera_metadata_t *buf); status_t setStreamSlot(const List<camera_metadata_t*> &bufs); status_t setStreamSlot(const List<camera_metadata_t*> &bufs); Loading