mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-14 07:59:44 +03:00
android: camera_device: Only construct required planes
The camera3buffer describes the number of filedescriptors given. Don't try to construct more planes than that. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
8ad1b9ca22
commit
f4c65be7b3
1 changed files with 12 additions and 1 deletions
|
@ -1118,9 +1118,20 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
|
|||
FrameBuffer *CameraDevice::createFrameBuffer(const buffer_handle_t camera3buffer)
|
||||
{
|
||||
std::vector<FrameBuffer::Plane> planes;
|
||||
for (unsigned int i = 0; i < 3; i++) {
|
||||
for (int i = 0; i < camera3buffer->numFds; i++) {
|
||||
/* Skip unused planes. */
|
||||
if (camera3buffer->data[i] == -1)
|
||||
break;
|
||||
|
||||
FrameBuffer::Plane plane;
|
||||
plane.fd = FileDescriptor(camera3buffer->data[i]);
|
||||
if (!plane.fd.isValid()) {
|
||||
LOG(HAL, Error) << "Failed to obtain FileDescriptor ("
|
||||
<< camera3buffer->data[i] << ") "
|
||||
<< " on plane " << i;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setting length to zero here is OK as the length is only used
|
||||
* to map the memory of the plane. Libcamera do not need to poke
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue