android: camera_stream: Make some member variables constant

CameraStream initializes several member variables in the
initializer list. Some of them are unchanged after. This makes
them constant. Especially, doing to |cameraDevice_| represents
CameraStream doesn't have the ownership of it.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Hirokazu Honda 2020-10-21 10:39:55 +09:00 committed by Kieran Bingham
parent 79bca4300b
commit bb27fbf253
2 changed files with 8 additions and 9 deletions

View file

@ -38,13 +38,12 @@ LOG_DECLARE_CATEGORY(HAL)
* and buffer allocation. * and buffer allocation.
*/ */
CameraStream::CameraStream(CameraDevice *cameraDevice, Type type, CameraStream::CameraStream(CameraDevice *const cameraDevice, Type type,
camera3_stream_t *camera3Stream, unsigned int index) camera3_stream_t *camera3Stream, unsigned int index)
: cameraDevice_(cameraDevice), type_(type), : cameraDevice_(cameraDevice),
config_(cameraDevice->cameraConfiguration()), type_(type),
camera3Stream_(camera3Stream), index_(index) camera3Stream_(camera3Stream), index_(index)
{ {
config_ = cameraDevice_->cameraConfiguration();
if (type_ == Type::Internal || type_ == Type::Mapped) { if (type_ == Type::Internal || type_ == Type::Mapped) {
/* /*
* \todo There might be multiple post-processors. The logic * \todo There might be multiple post-processors. The logic

View file

@ -109,7 +109,7 @@ public:
Internal, Internal,
Mapped, Mapped,
}; };
CameraStream(CameraDevice *cameraDevice, Type type, CameraStream(CameraDevice *const cameraDevice, Type type,
camera3_stream_t *camera3Stream, unsigned int index); camera3_stream_t *camera3Stream, unsigned int index);
Type type() const { return type_; } Type type() const { return type_; }
@ -124,11 +124,11 @@ public:
void putBuffer(libcamera::FrameBuffer *buffer); void putBuffer(libcamera::FrameBuffer *buffer);
private: private:
CameraDevice *cameraDevice_; CameraDevice *const cameraDevice_;
libcamera::CameraConfiguration *config_; const libcamera::CameraConfiguration *config_;
Type type_; const Type type_;
camera3_stream_t *camera3Stream_; camera3_stream_t *camera3Stream_;
unsigned int index_; const unsigned int index_;
std::unique_ptr<libcamera::FrameBufferAllocator> allocator_; std::unique_ptr<libcamera::FrameBufferAllocator> allocator_;
std::vector<libcamera::FrameBuffer *> buffers_; std::vector<libcamera::FrameBuffer *> buffers_;