android: camera_device: Make CameraStream configuration nicer

Loop over the CameraStream instances and use their interface to perform
CameraStream configuration.

Modify CameraStream::configure() to configure the android stream buffer
count and to retrieve the StreamConfiguration by index instead of
receiving it as a parameter.

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:
Jacopo Mondi 2020-10-03 13:45:29 +02:00
parent fc1fcb5bc9
commit 6c8837da5e
3 changed files with 14 additions and 14 deletions

View file

@ -1287,17 +1287,12 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
* StreamConfiguration and set the number of required buffers in
* the Android camera3_stream_t.
*/
for (unsigned int i = 0; i < stream_list->num_streams; ++i) {
camera3_stream_t *stream = stream_list->streams[i];
CameraStream *cameraStream = static_cast<CameraStream *>(stream->priv);
const StreamConfiguration &cfg = cameraStream->configuration();
int ret = cameraStream->configure(cfg);
if (ret)
for (CameraStream &cameraStream : streams_) {
int ret = cameraStream.configure();
if (ret) {
LOG(HAL, Error) << "Failed to configure camera stream";
return ret;
/* Use the bufferCount confirmed by the validation process. */
stream->max_buffers = cfg.bufferCount;
}
}
/*