[{"id":15901,"web_url":"https://patchwork.libcamera.org/comment/15901/","msgid":"<YFyjpxbY++jABQMi@pendragon.ideasonboard.com>","date":"2021-03-25T14:52:23","subject":"Re: [libcamera-devel] [PATCH 1/2] android: CameraDevice: Mark\n\tgetResultMetadata() const function","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Hiro,\n\nThank you for the patch.\n\nOn Thu, Mar 25, 2021 at 08:13:56PM +0900, Hirokazu Honda wrote:\n> CameraDevice::getResultMetadata() doesn't change either\n> |descriptor| and member variables. It should be marked as a\n> const function and |descriptor| should be passed with const\n> lvalue reference.\n\nThe patch itself looks good to me. I'd however like Jacopo's feedback,\nas he has designed these classes, regarding whether he foresees a need\nto modify the descriptor in that function in the near future.\n\nIf Jacopo is fine with the patch, you can also add my\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> ---\n>  src/android/camera_device.cpp | 10 +++++-----\n>  src/android/camera_device.h   |  3 ++-\n>  2 files changed, 7 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 5fbf6f82..ae693664 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -1924,7 +1924,7 @@ void CameraDevice::requestComplete(Request *request)\n>  \t * pipeline handlers) timestamp in the Request itself.\n>  \t */\n>  \tuint64_t timestamp = buffers.begin()->second->metadata().timestamp;\n> -\tresultMetadata = getResultMetadata(descriptor, timestamp);\n> +\tresultMetadata = getResultMetadata(*descriptor, timestamp);\n> \n>  \t/* Handle any JPEG compression. */\n>  \tfor (camera3_stream_buffer_t &buffer : descriptor->buffers_) {\n> @@ -2030,11 +2030,11 @@ void CameraDevice::notifyError(uint32_t frameNumber, camera3_stream_t *stream)\n>   * Produce a set of fixed result metadata.\n>   */\n>  std::unique_ptr<CameraMetadata>\n> -CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n> -\t\t\t\tint64_t timestamp)\n> +CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor,\n> +\t\t\t\tint64_t timestamp) const\n>  {\n> -\tconst ControlList &metadata = descriptor->request_->metadata();\n> -\tconst CameraMetadata &settings = descriptor->settings_;\n> +\tconst ControlList &metadata = descriptor.request_->metadata();\n> +\tconst CameraMetadata &settings = descriptor.settings_;\n>  \tcamera_metadata_ro_entry_t entry;\n>  \tbool found;\n> \n> diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> index 09c395ff..11bdfec8 100644\n> --- a/src/android/camera_device.h\n> +++ b/src/android/camera_device.h\n> @@ -102,7 +102,8 @@ private:\n>  \tlibcamera::PixelFormat toPixelFormat(int format) const;\n>  \tint processControls(Camera3RequestDescriptor *descriptor);\n>  \tstd::unique_ptr<CameraMetadata> getResultMetadata(\n> -\t\tCamera3RequestDescriptor *descriptor, int64_t timestamp);\n> +\t\tconst Camera3RequestDescriptor &descriptor,\n> +\t\tint64_t timestamp) const;\n> \n>  \tunsigned int id_;\n>  \tcamera3_device_t camera3Device_;","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 BC467BDC66\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Mar 2021 14:53:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2142868D6A;\n\tThu, 25 Mar 2021 15:53:09 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 89560602D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 15:53:07 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 61C6F560;\n\tThu, 25 Mar 2021 15:53:06 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"wc67jfw3\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1616683986;\n\tbh=8ZeZrRHERdohxxTF8EFIlRS6fRSAS4w2q0jivkOuMvE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=wc67jfw3DfH0nzG9JJOgnGfhN+7VWEP4nrHLa+kzLpopLtjk5K2Cs7mpcQys3//02\n\t9VpQ39WM6NfFcG7/gCeh+/wkRMYuL+rvsSvE2xM0vjCBTNQ9czs7F6J6xyil09elqF\n\tJjZAMc/8VqHhaPdXe0UeZhdV10MDP/5K9exsHT5A=","Date":"Thu, 25 Mar 2021 16:52:23 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<YFyjpxbY++jABQMi@pendragon.ideasonboard.com>","References":"<20210325111357.3862847-1-hiroh@chromium.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210325111357.3862847-1-hiroh@chromium.org>","Subject":"Re: [libcamera-devel] [PATCH 1/2] android: CameraDevice: Mark\n\tgetResultMetadata() const function","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>","Cc":"libcamera-devel@lists.libcamera.org","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>"}},{"id":15903,"web_url":"https://patchwork.libcamera.org/comment/15903/","msgid":"<20210325160439.lnb7j6ewtotiqcsv@uno.localdomain>","date":"2021-03-25T16:04:39","subject":"Re: [libcamera-devel] [PATCH 1/2] android: CameraDevice: Mark\n\tgetResultMetadata() const function","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Thu, Mar 25, 2021 at 04:52:23PM +0200, Laurent Pinchart wrote:\n> Hi Hiro,\n>\n> Thank you for the patch.\n>\n> On Thu, Mar 25, 2021 at 08:13:56PM +0900, Hirokazu Honda wrote:\n> > CameraDevice::getResultMetadata() doesn't change either\n> > |descriptor| and member variables. It should be marked as a\n> > const function and |descriptor| should be passed with const\n> > lvalue reference.\n>\n> The patch itself looks good to me. I'd however like Jacopo's feedback,\n> as he has designed these classes, regarding whether he foresees a need\n> to modify the descriptor in that function in the near future.\n\nAs far as I can tell this should not happen.\nIn any case we can rollback if that need arise in future.\n\n>\n> If Jacopo is fine with the patch, you can also add my\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n>\n> > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> > ---\n> >  src/android/camera_device.cpp | 10 +++++-----\n> >  src/android/camera_device.h   |  3 ++-\n> >  2 files changed, 7 insertions(+), 6 deletions(-)\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index 5fbf6f82..ae693664 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -1924,7 +1924,7 @@ void CameraDevice::requestComplete(Request *request)\n> >  \t * pipeline handlers) timestamp in the Request itself.\n> >  \t */\n> >  \tuint64_t timestamp = buffers.begin()->second->metadata().timestamp;\n> > -\tresultMetadata = getResultMetadata(descriptor, timestamp);\n> > +\tresultMetadata = getResultMetadata(*descriptor, timestamp);\n> >\n> >  \t/* Handle any JPEG compression. */\n> >  \tfor (camera3_stream_buffer_t &buffer : descriptor->buffers_) {\n> > @@ -2030,11 +2030,11 @@ void CameraDevice::notifyError(uint32_t frameNumber, camera3_stream_t *stream)\n> >   * Produce a set of fixed result metadata.\n> >   */\n> >  std::unique_ptr<CameraMetadata>\n> > -CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor,\n> > -\t\t\t\tint64_t timestamp)\n> > +CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor,\n> > +\t\t\t\tint64_t timestamp) const\n> >  {\n> > -\tconst ControlList &metadata = descriptor->request_->metadata();\n> > -\tconst CameraMetadata &settings = descriptor->settings_;\n> > +\tconst ControlList &metadata = descriptor.request_->metadata();\n> > +\tconst CameraMetadata &settings = descriptor.settings_;\n> >  \tcamera_metadata_ro_entry_t entry;\n> >  \tbool found;\n> >\n> > diff --git a/src/android/camera_device.h b/src/android/camera_device.h\n> > index 09c395ff..11bdfec8 100644\n> > --- a/src/android/camera_device.h\n> > +++ b/src/android/camera_device.h\n> > @@ -102,7 +102,8 @@ private:\n> >  \tlibcamera::PixelFormat toPixelFormat(int format) const;\n> >  \tint processControls(Camera3RequestDescriptor *descriptor);\n> >  \tstd::unique_ptr<CameraMetadata> getResultMetadata(\n> > -\t\tCamera3RequestDescriptor *descriptor, int64_t timestamp);\n> > +\t\tconst Camera3RequestDescriptor &descriptor,\n> > +\t\tint64_t timestamp) const;\n> >\n> >  \tunsigned int id_;\n> >  \tcamera3_device_t camera3Device_;\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 58E09BDC66\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 25 Mar 2021 16:04:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DE5C468D65;\n\tThu, 25 Mar 2021 17:04:07 +0100 (CET)","from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 03319602D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 25 Mar 2021 17:04:06 +0100 (CET)","from uno.localdomain (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay10.mail.gandi.net (Postfix) with ESMTPSA id 1CF31240008;\n\tThu, 25 Mar 2021 16:04:05 +0000 (UTC)"],"Date":"Thu, 25 Mar 2021 17:04:39 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20210325160439.lnb7j6ewtotiqcsv@uno.localdomain>","References":"<20210325111357.3862847-1-hiroh@chromium.org>\n\t<YFyjpxbY++jABQMi@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<YFyjpxbY++jABQMi@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 1/2] android: CameraDevice: Mark\n\tgetResultMetadata() const function","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>","Cc":"libcamera-devel@lists.libcamera.org","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>"}}]