From patchwork Wed Oct 21 01:39:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10154 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9AD7EBDB13 for ; Wed, 21 Oct 2020 01:40:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 66E8661DCF; Wed, 21 Oct 2020 03:40:11 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Zbdb08lG"; dkim-atps=neutral Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6340461D98 for ; Wed, 21 Oct 2020 03:40:10 +0200 (CEST) Received: by mail-pf1-x431.google.com with SMTP id 10so510422pfp.5 for ; Tue, 20 Oct 2020 18:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VsrjIa5fn9BIm7cmFlwzxqjDvLZ5QlFd0dv9kJ5Bx3c=; b=Zbdb08lGBT7rswY33ejR7uk+jonCvRLtDo7zA6WRyWqKM/04mjMyGkMzCUw1nPdEGr 7Na9ys79hqn77lRyOSYokygKekxn5yY7svel8lr6bnkcwxqM6uNMe8jP9xptBDhjJmv3 H+Qs1AaiMeOJXZe7sgWiDnbHdFQ8MAPVw27+4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VsrjIa5fn9BIm7cmFlwzxqjDvLZ5QlFd0dv9kJ5Bx3c=; b=e/b2n+6AL7e/uY+CEZoO2r9WSYOqBoAP90k9GOg3i4iwowJOMs0uG5gbNkQtUag4Z6 W88ICY2Qe5Fbq0mF/+TfjamDOaogW2L6+XLKdzPoL3/ofxj3ML1PurVOgIWb+hkI1GAc ib5BEXxvdjxtImNp7EAh3wxl8EmG1wpN1EGaDV53VOVeZHZRn/5HRJhE2+Y0/uFfk9BM T2zNmPWCwXctZSHMiK2xefBgSeiLQn8JAgtMec8WyllxzvVO/atrghcTFeOdkSpw7LP4 S/Pf7l08c7UPRYtLHra3RKLJE6xjCNv6ksZ0h3+iEGt9d2I8POVlYeA2RKa42Ww07bWZ Czkw== X-Gm-Message-State: AOAM530x1i3wvUMyr++VCW3ljg4IlBlTcdmi8UpeRniy5pPvzPdHp0lT J3qgs7D3ULG6y8I+ymFh6wuSUtu6aJxTVg== X-Google-Smtp-Source: ABdhPJyLyumRCeelgrgHalCXiOe/9FiQKQkRMnxI8+r+Aq8q1xcEHwiKsqyj5MjXuAHa1N/Mfmdx0w== X-Received: by 2002:a63:d90d:: with SMTP id r13mr904026pgg.99.1603244408832; Tue, 20 Oct 2020 18:40:08 -0700 (PDT) Received: from hiroh.tok.corp.google.com ([2401:fa00:8f:2:de4a:3eff:fe7d:f78f]) by smtp.gmail.com with ESMTPSA id w2sm368066pgi.56.2020.10.20.18.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 18:40:08 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 21 Oct 2020 10:39:55 +0900 Message-Id: <20201021013955.301790-4-hiroh@chromium.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog In-Reply-To: <20201021013955.301790-1-hiroh@chromium.org> References: <20201021013955.301790-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 4/4] android: camera_stream: Make some member variables constant X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Umang Jain Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/android/camera_stream.cpp | 7 +++---- src/android/camera_stream.h | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 3e5d6be..dba351a 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -38,13 +38,12 @@ LOG_DECLARE_CATEGORY(HAL) * and buffer allocation. */ -CameraStream::CameraStream(CameraDevice *cameraDevice, Type type, +CameraStream::CameraStream(CameraDevice *const cameraDevice, Type type, camera3_stream_t *camera3Stream, unsigned int index) - : cameraDevice_(cameraDevice), type_(type), + : cameraDevice_(cameraDevice), + config_(cameraDevice->cameraConfiguration()), type_(type), camera3Stream_(camera3Stream), index_(index) { - config_ = cameraDevice_->cameraConfiguration(); - if (type_ == Type::Internal || type_ == Type::Mapped) { /* * \todo There might be multiple post-processors. The logic diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index c367a5f..cc9d547 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -109,7 +109,7 @@ public: Internal, Mapped, }; - CameraStream(CameraDevice *cameraDevice, Type type, + CameraStream(CameraDevice *const cameraDevice, Type type, camera3_stream_t *camera3Stream, unsigned int index); Type type() const { return type_; } @@ -124,11 +124,11 @@ public: void putBuffer(libcamera::FrameBuffer *buffer); private: - CameraDevice *cameraDevice_; - libcamera::CameraConfiguration *config_; - Type type_; + CameraDevice *const cameraDevice_; + const libcamera::CameraConfiguration *config_; + const Type type_; camera3_stream_t *camera3Stream_; - unsigned int index_; + const unsigned int index_; std::unique_ptr allocator_; std::vector buffers_;