{"id":20846,"url":"https://patchwork.libcamera.org/api/patches/20846/?format=json","web_url":"https://patchwork.libcamera.org/patch/20846/","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":"<20240808173041.2505335-1-kieran.bingham@ideasonboard.com>","date":"2024-08-08T17:30:41","name":"libcamera: v4l2_videodevice: Improve readability","commit_ref":"33a49ce4a265c88ade6cc7e94d5124f5d6ebaea0","pull_url":null,"state":"accepted","archived":false,"hash":"d6a24c5fd4163f17e1df87aa2434d258d6eda10a","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20846/mbox/","series":[{"id":4504,"url":"https://patchwork.libcamera.org/api/series/4504/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4504","date":"2024-08-08T17:30:41","name":"libcamera: v4l2_videodevice: Improve readability","version":1,"mbox":"https://patchwork.libcamera.org/series/4504/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20846/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20846/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 BE7D1BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Aug 2024 17:30:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E669A61955;\n\tThu,  8 Aug 2024 19:30:46 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D64261955\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Aug 2024 19:30:45 +0200 (CEST)","from Monstersaurus.tail69b4.ts.net\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 539CC8D0;\n\tThu,  8 Aug 2024 19:29:51 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"o8QTJmPn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723138191;\n\tbh=p3Xa2aembf303Av+U1/qRVxlpKiDj1GeGl/f285RvVM=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=o8QTJmPnnmh/TaaJjfu6slmBoYAaU5JYMJDgoVW3LgFPoamWTBqiVf3FM0Z06cVHt\n\tBxGBqunPNoWZn0BTMLqnsemzCt7ECbgEajp3j4iTieyGnId14/uwVAkjlWcd0oSIE3\n\tPZeLYOlienxl+lYAnVzgCSOIGNg8ukgvlC0XztZI=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"[PATCH] libcamera: v4l2_videodevice: Improve readability","Date":"Thu,  8 Aug 2024 18:30:41 +0100","Message-Id":"<20240808173041.2505335-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.34.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Stefan Klug <stefan.klug@ideasonboard.com>\n\nThe handling for the sequence number validation within\nV4L2VideoDevice::dequeueBuffer makes use of a std::optional, which can\nbe used as a boolean in conditional statements. This has the impact in\nthis use case that it can be mis-read to be interpretting the value for\nfirstFrame_ which is assigned as teh buf.sequence.\n\nRemove this potential for confusion by making it clear that the first\nframe handling is only performed when firstFrame_ does not have a value\nassigned.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n[Kieran: Rework commit message]\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/v4l2_videodevice.cpp | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex 6f32521f3d6f..59379308d5b3 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -1841,7 +1841,7 @@ FrameBuffer *V4L2VideoDevice::dequeueBuffer()\n \t * Detect kernel drivers which do not reset the sequence number to zero\n \t * on stream start.\n \t */\n-\tif (!firstFrame_) {\n+\tif (!firstFrame_.has_value()) {\n \t\tif (buf.sequence)\n \t\t\tLOG(V4L2, Info)\n \t\t\t\t<< \"Zero sequence expected for first frame (got \"\n","prefixes":[]}