android: camera_stream: Create buffer pool
Add a FrameBufferAllocator class member to the CameraStream class. The allocator is constructed for CameraStream instances that needs internal allocation and automatically deleted. Allocate FrameBuffers using the allocator_ class member in the CameraStream class at CameraStream::configure() time and add two methods to the CameraStream class to get and put FrameBuffer pointers from the pool of allocated buffers. As buffer allocation can take place only after the Camera has been configured, move the CameraStream configuration loop in the CameraDevice class after camera_->configure() call. The newly created pool will be used to provide buffers to CameraStream that need to provide memory to libcamera where to deliver frames. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
6c8837da5e
commit
b84e35dc97
3 changed files with 67 additions and 11 deletions
|
@ -1282,6 +1282,17 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Once the CameraConfiguration has been adjusted/validated
|
||||
* it can be applied to the camera.
|
||||
*/
|
||||
int ret = camera_->configure(config_.get());
|
||||
if (ret) {
|
||||
LOG(HAL, Error) << "Failed to configure camera '"
|
||||
<< camera_->id() << "'";
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Configure the HAL CameraStream instances using the associated
|
||||
* StreamConfiguration and set the number of required buffers in
|
||||
|
@ -1295,17 +1306,6 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Once the CameraConfiguration has been adjusted/validated
|
||||
* it can be applied to the camera.
|
||||
*/
|
||||
int ret = camera_->configure(config_.get());
|
||||
if (ret) {
|
||||
LOG(HAL, Error) << "Failed to configure camera '"
|
||||
<< camera_->id() << "'";
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue