[{"id":20137,"web_url":"https://patchwork.libcamera.org/comment/20137/","msgid":"<163403741592.2943484.12457394596940840718@Monstersaurus>","date":"2021-10-12T11:16:55","subject":"Re: [libcamera-devel] [PATCH 3/3] cam: Drop frames once the capture\n\tlimit is reached","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2021-10-12 03:23:21)\n> The camera session keeps requeuing requests until the capture limit is\n> reached. This causes more request than the limit to complete, as there's\n> a queue of requests in flight. When capturing from multiple cameras\n> concurrently, this results in the captureDone signal being emitted for\n> every request completion after the limit is reached, instead of once per\n> camera session when reaching the limit.\n> \n> Fix this by simply dropping any request that completes after the limit\n> is reached. We could instead avoid requeuing more requests than needed\n> to reach the limit, but that may cause request starvation in pipelines,\n> which are currently not handled consistently (or correctly).\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/cam/camera_session.cpp | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp\n> index 605018278c5a..594cd51bb6a2 100644\n> --- a/src/cam/camera_session.cpp\n> +++ b/src/cam/camera_session.cpp\n> @@ -348,6 +348,9 @@ void CameraSession::processRequest(Request *request)\n>  {\n>         const Request::BufferMap &buffers = request->buffers();\n>  \n\nI'd be tempted to put a comment here to explain that this is different\nfrom, and required as well as the similar check down at the end of the\nfunction.\n\nBut either way:\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> +       if (captureLimit_ && captureCount_ >= captureLimit_)\n> +               return;\n> +\n>         /*\n>          * Compute the frame rate. The timestamp is arbitrarily retrieved from\n>          * the first buffer, as all buffers should have matching timestamps.\n> -- \n> Regards,\n> \n> Laurent Pinchart\n>","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 BEA33BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Oct 2021 11:17:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1AA6368F4F;\n\tTue, 12 Oct 2021 13:17:00 +0200 (CEST)","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 2FAEB68F4C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Oct 2021 13:16:59 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C0427F1;\n\tTue, 12 Oct 2021 13:16:58 +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=\"oV3f9ejf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634037418;\n\tbh=FS18az+R+/gSUIkd0NbeHgKk0XRCTwgytC+brokAcvA=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=oV3f9ejfUSJdGjnWrDmgN4cqnfHpddaVLZ9QI0n/09OMeAHEJeQuVNpOUxhi9uJR5\n\tYnKDRVTfdCs4uf3e00Q6QzXZWQofK/LrMpV439j2b7mSi1/eQapj9NiCLOPS0fooTP\n\t2eyXegQHIlx3bBNV7sbiwJQ8djov0XWdcoEtp9nw=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20211012022321.27034-4-laurent.pinchart@ideasonboard.com>","References":"<20211012022321.27034-1-laurent.pinchart@ideasonboard.com>\n\t<20211012022321.27034-4-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 12 Oct 2021 12:16:55 +0100","Message-ID":"<163403741592.2943484.12457394596940840718@Monstersaurus>","User-Agent":"alot/0.9.1","Subject":"Re: [libcamera-devel] [PATCH 3/3] cam: Drop frames once the capture\n\tlimit is reached","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>"}}]