{"id":11830,"url":"https://patchwork.libcamera.org/api/patches/11830/?format=json","web_url":"https://patchwork.libcamera.org/patch/11830/","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":"<20210403133741.1595440-1-hiroh@chromium.org>","date":"2021-04-03T13:37:40","name":"[libcamera-devel,v4,1/2] android: cameraDevice: Factorize the code of validating camera3_capture_request","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"feecdfd2fc98b7fec382910d790bcded3f3e0001","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/11830/mbox/","series":[{"id":1887,"url":"https://patchwork.libcamera.org/api/series/1887/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1887","date":"2021-04-03T13:37:40","name":"[libcamera-devel,v4,1/2] android: cameraDevice: Factorize the code of validating camera3_capture_request","version":4,"mbox":"https://patchwork.libcamera.org/series/1887/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11830/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11830/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 5C98EBD695\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat,  3 Apr 2021 13:37:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C74CB6877E;\n\tSat,  3 Apr 2021 15:37:50 +0200 (CEST)","from mail-pg1-x532.google.com (mail-pg1-x532.google.com\n\t[IPv6:2607:f8b0:4864:20::532])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5C52E602CF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  3 Apr 2021 15:37:49 +0200 (CEST)","by mail-pg1-x532.google.com with SMTP id k8so5240344pgf.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 03 Apr 2021 06:37:49 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:d1f5:1b96:f027:f646])\n\tby smtp.gmail.com with ESMTPSA id\n\ts17sm10997414pfc.53.2021.04.03.06.37.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tSat, 03 Apr 2021 06:37:47 -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=\"UhsNhyei\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=t6notvtEduCbgHjICfAQiA3fscbYZUm2hqc/YBsESnY=;\n\tb=UhsNhyei+eAi4kJMOOx5ei3iDJ/GhYpJla8pVLf/MNGGppJaNT8Z5WmwHkqxm7p/+t\n\tQ8mzEc5KtFrTGy0IrmHYgLZuEO9hsvxLw7Ge8Za1kkVZn/NdIWpnIedWu8A5zr70FKff\n\tlyhxcPGMF0TCKcVJyVq8g0kQkhC4HIKN1GEdk=","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:mime-version\n\t:content-transfer-encoding;\n\tbh=t6notvtEduCbgHjICfAQiA3fscbYZUm2hqc/YBsESnY=;\n\tb=SSxo6lLVkpCLafJnxS5yAHIu9PknZAmUP6+nZguJn1rWpNekdGwwnLnBxI8wjpvAWd\n\t+I6GSvrL+vuCMrCp2ddVMhicF174DzYLg39hDYndE8Rkz6VCJhEPBeE1yGX+nkYz8SkG\n\t26u8C366xJNZE4zTYQmgKJ5UeAvVRFC4H28srQ/g8dUj2bG/pewSe/8txu46Z+TGDUr5\n\tRLLRvRtkNr029f7iVuGqclWdUGvfUKIiWcSyzefnokoVbhSLxTJ/DSzPeE1MyBPY8o/h\n\tnvrFgaSkHHv1TzfPXTK/KskRsfe4UO2qLIjOQaZrvmvAOZ7EPc3EfjtwwpzXqLP5OedS\n\tSGjA==","X-Gm-Message-State":"AOAM531iwgQvD4jJ9mlV6Owfx4JrYiwMAsbrkOtIbwcuCGKLaY+d7/sp\n\tiBG4CLuGt1wpI25oGr3XW16OXyfdgBqcIQ==","X-Google-Smtp-Source":"ABdhPJw86qNwYGBL3JaqccPXaiGCc9LYeUNT+7b6Tyymkv82ek38dzxQjXkAnrocL6USF1g1Ba2fww==","X-Received":"by 2002:aa7:9edb:0:b029:202:ec35:a893 with SMTP id\n\tr27-20020aa79edb0000b0290202ec35a893mr8141248pfq.22.1617457067708; \n\tSat, 03 Apr 2021 06:37:47 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat,  3 Apr 2021 22:37:40 +0900","Message-Id":"<20210403133741.1595440-1-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.208.g409f899ff0-goog","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v4 1/2] android: cameraDevice: Factorize\n\tthe code of validating camera3_capture_request","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":"CameraDevice::processCaptureRequest() checks the validness of a\nprovided camera3_capture_request. This factorizes the code in\norder to add more validation to the request later.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_device.cpp | 24 ++++++++++++++++--------\n 1 file changed, 16 insertions(+), 8 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex eb327978..d8ce43be 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -256,6 +256,21 @@ void sortCamera3StreamConfigs(std::vector<Camera3StreamConfig> &unsortedConfigs,\n \tunsortedConfigs = sortedConfigs;\n }\n \n+bool isValidRequest(camera3_capture_request_t *camera3Request)\n+{\n+\tif (!camera3Request) {\n+\t\tLOG(HAL, Error) << \"No capture request provided\";\n+\t\treturn false;\n+\t}\n+\n+\tif (!camera3Request->num_output_buffers) {\n+\t\tLOG(HAL, Error) << \"No output buffers provided\";\n+\t\treturn false;\n+\t}\n+\n+\treturn true;\n+}\n+\n } /* namespace */\n \n /*\n@@ -1785,15 +1800,8 @@ int CameraDevice::processControls(Camera3RequestDescriptor *descriptor)\n \n int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Request)\n {\n-\tif (!camera3Request) {\n-\t\tLOG(HAL, Error) << \"No capture request provided\";\n+\tif (!isValidRequest(camera3Request))\n \t\treturn -EINVAL;\n-\t}\n-\n-\tif (!camera3Request->num_output_buffers) {\n-\t\tLOG(HAL, Error) << \"No output buffers provided\";\n-\t\treturn -EINVAL;\n-\t}\n \n \t/* Start the camera if that's the first request we handle. */\n \tif (!running_) {\n","prefixes":["libcamera-devel","v4","1/2"]}