diff options
-rw-r--r-- | src/android/camera_device.cpp | 15 | ||||
-rw-r--r-- | src/android/camera_stream.cpp | 11 | ||||
-rw-r--r-- | src/android/camera_stream.h | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 678dca60..1e2cbeeb 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -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; + } } /* diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 3946a2cd..f899be4f 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -38,10 +38,15 @@ Stream *CameraStream::stream() const return configuration().stream(); } -int CameraStream::configure(const libcamera::StreamConfiguration &cfg) +int CameraStream::configure() { - if (encoder_) - return encoder_->configure(cfg); + if (encoder_) { + int ret = encoder_->configure(configuration()); + if (ret) + return ret; + } + + camera3Stream_->max_buffers = configuration().bufferCount; return 0; } diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index f46cfd60..4c51f0fb 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -114,7 +114,7 @@ public: const libcamera::StreamConfiguration &configuration() const; libcamera::Stream *stream() const; - int configure(const libcamera::StreamConfiguration &cfg); + int configure(); int process(const libcamera::FrameBuffer &source, MappedCamera3Buffer *dest, CameraMetadata *metadata); |