{"id":10124,"url":"https://patchwork.libcamera.org/api/patches/10124/?format=json","web_url":"https://patchwork.libcamera.org/patch/10124/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20201020074229.119151-4-hiroh@chromium.org>","date":"2020-10-20T07:42:29","name":"[libcamera-devel,v2,4/4] android: camera_stream: Make some member variables constant","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"04d54d6a475bfc7d91577d46fa5c25446bf7c461","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10124/mbox/","series":[{"id":1389,"url":"https://patchwork.libcamera.org/api/series/1389/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1389","date":"2020-10-20T07:42:26","name":"[libcamera-devel,v2,1/4] android: Modify PostProcessor interface","version":2,"mbox":"https://patchwork.libcamera.org/series/1389/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10124/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10124/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 8200FBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 20 Oct 2020 07:42:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4E633610C4;\n\tTue, 20 Oct 2020 09:42:46 +0200 (CEST)","from mail-pg1-x531.google.com (mail-pg1-x531.google.com\n\t[IPv6:2607:f8b0:4864:20::531])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 06CB761394\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Oct 2020 09:42:45 +0200 (CEST)","by mail-pg1-x531.google.com with SMTP id t14so589135pgg.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 20 Oct 2020 00:42:44 -0700 (PDT)","from hiroh.tok.corp.google.com\n\t([2401:fa00:8f:2:de4a:3eff:fe7d:f78f])\n\tby smtp.gmail.com with ESMTPSA id\n\td26sm1193684pfo.82.2020.10.20.00.42.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 20 Oct 2020 00:42:42 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"dnzjYHx4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=DHCLfJ0ITVxCOAjl+xiD/qqBE4LmukKaknHvfygvs/o=;\n\tb=dnzjYHx4pOO4r6mO20SrCg0hdqV6eAE78uXNBjOpAB3TeEHPDWM+3JvQtl1xcq2BWu\n\tqfeJ8LLyLf1xY8ZK1Ig50Snu04zBSTWxjwp47A9gQKyFFX+yYQ8NXz9zhA6SPYf4OhqH\n\tMdL8t3xd5myqWIJ2oYE9BRw91Ac0ZR//3buUQ=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=DHCLfJ0ITVxCOAjl+xiD/qqBE4LmukKaknHvfygvs/o=;\n\tb=CJB9qgg2RFGTiqwRTxIBwXXsiYgv3JA/NzYxRflntJurCjy4lxnD68PyGdJ/nCt1My\n\tA25b0ARuK93GpcalKrRs9LUa5s/hfhLaV6KVOph4ex0xLDr1mzIQdSTRAwOmg8JNepFf\n\tlCBraBdNmx+d9QoPj0OHUu1GHkBkL0MrpczOzUTTfXQRXfjWNDw0Lj4/5KcNe/jq2QN5\n\t79qtaMPaPbPuS9o3FSuHMH4mfZWvgL0CSFa8kVUg3YqafMe85M/+2rHEU4V140l5cH6U\n\tbzVcnGE7QZ0nadYpsXUBgeBidHplO0+pBCzghNQiOXqi81xSCdS5HE1g5afoSsUSVyGU\n\tuNOg==","X-Gm-Message-State":"AOAM5318Lrr4JJ0HL8b7jTwJ4V3VrwSthocNEEpinIfK+1LvE2II4QJ9\n\t+fm+q6ZIkxKb14aDti+oLBapdsPlZEJb9w==","X-Google-Smtp-Source":"ABdhPJzWS51yACj38RQUzxBGxTOwIbhrF4Ov/sNx4g7aR3Q6JjE6HSNwTZt7oKjSgYNJLmRKvfsMzg==","X-Received":"by 2002:a65:5b48:: with SMTP id y8mr1582578pgr.67.1603179763376; \n\tTue, 20 Oct 2020 00:42:43 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 20 Oct 2020 16:42:29 +0900","Message-Id":"<20201020074229.119151-4-hiroh@chromium.org>","X-Mailer":"git-send-email 2.29.0.rc1.297.gfa9743e501-goog","In-Reply-To":"<20201020074229.119151-1-hiroh@chromium.org>","References":"<20201020074229.119151-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 4/4] android: camera_stream: Make some\n\tmember variables constant","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"CameraStream initializes several member variables in the\ninitializer list. Some of them are unchanged after. This makes\nthem constant. Especially, doing to |cameraDevice_| represents\nCameraStream doesn't have the ownership of it.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_stream.cpp |  7 +++----\n src/android/camera_stream.h   | 10 +++++-----\n 2 files changed, 8 insertions(+), 9 deletions(-)","diff":"diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 28a6e09..9644b74 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -38,13 +38,12 @@ LOG_DECLARE_CATEGORY(HAL);\n  * and buffer allocation.\n  */\n \n-CameraStream::CameraStream(CameraDevice *cameraDevice, Type type,\n+CameraStream::CameraStream(CameraDevice const *cameraDevice, Type type,\n \t\t\t   camera3_stream_t *camera3Stream, unsigned int index)\n-\t: cameraDevice_(cameraDevice), type_(type),\n+\t: cameraDevice_(cameraDevice),\n+\t  config_(cameraDevice->cameraConfiguration()), type_(type),\n \t  camera3Stream_(camera3Stream), index_(index)\n {\n-\tconfig_ = cameraDevice_->cameraConfiguration();\n-\n \tif (type_ == Type::Internal || type_ == Type::Mapped) {\n \t\t/*\n \t\t * \\todo There might be multiple post-processors. The logic\ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex c367a5f..23c139d 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -109,7 +109,7 @@ public:\n \t\tInternal,\n \t\tMapped,\n \t};\n-\tCameraStream(CameraDevice *cameraDevice, Type type,\n+\tCameraStream(CameraDevice const *cameraDevice, Type type,\n \t\t     camera3_stream_t *camera3Stream, unsigned int index);\n \n \tType type() const { return type_; }\n@@ -124,11 +124,11 @@ public:\n \tvoid putBuffer(libcamera::FrameBuffer *buffer);\n \n private:\n-\tCameraDevice *cameraDevice_;\n-\tlibcamera::CameraConfiguration *config_;\n-\tType type_;\n+\tCameraDevice const *cameraDevice_;\n+\tconst libcamera::CameraConfiguration *config_;\n+\tconst Type type_;\n \tcamera3_stream_t *camera3Stream_;\n-\tunsigned int index_;\n+\tconst unsigned int index_;\n \n \tstd::unique_ptr<libcamera::FrameBufferAllocator> allocator_;\n \tstd::vector<libcamera::FrameBuffer *> buffers_;\n","prefixes":["libcamera-devel","v2","4/4"]}