{"id":22679,"url":"https://patchwork.libcamera.org/api/1.1/patches/22679/?format=json","web_url":"https://patchwork.libcamera.org/patch/22679/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20250130115001.1129305-21-pobrn@protonmail.com>","date":"2025-01-30T11:51:46","name":"[RFC,v3,20/21] apps: lc-compliance: Make `EventLoop` a member","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d91232b70c2bd314b18075f10846a2fdf79a1561","submitter":{"id":133,"url":"https://patchwork.libcamera.org/api/1.1/people/133/?format=json","name":"Pőcze Barnabás","email":"pobrn@protonmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22679/mbox/","series":[{"id":4978,"url":"https://patchwork.libcamera.org/api/1.1/series/4978/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4978","date":"2025-01-30T11:50:08","name":"apps: lc-compliance: Multi-stream tests","version":3,"mbox":"https://patchwork.libcamera.org/series/4978/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22679/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22679/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 316E8BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Jan 2025 11:51:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DE3BF6858A;\n\tThu, 30 Jan 2025 12:51:51 +0100 (CET)","from mail-10629.protonmail.ch (mail-10629.protonmail.ch\n\t[79.135.106.29])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F216968588\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jan 2025 12:51:49 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"WbYefwHS\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1738237909; x=1738497109;\n\tbh=44uTnHhpmqWaFRo7925aVDpsEg8M002arxNUFiLyCvI=;\n\th=Date:To:From:Subject:Message-ID:In-Reply-To:References:\n\tFeedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n\tMessage-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;\n\tb=WbYefwHS1iN85kUeUVfNxGINy+z12gEOu1xUCTli5/CDeDYotrmB20TZK6TYi6M5V\n\t32D34FvxO98qOr9yxyZGaTD+kCTXKGhvkhALQA/iYYHpgtwEUjY097C1M6MXoAcu1e\n\twP+bOhlh0k7envL8QyIHOx+bRUzHa+DbV6JaONike4ONr67Pz9oDAKKvXy+tkZBy3n\n\tSio9HTMhgYztJiJQH+eloAY5UaAMMmqyikaaZbW0R/Y5EFsSrQgx9UahTOyyRaDx6f\n\tR/wINsyvmDHkfe4uNM/YyLFIdyD9FWpzWzgkxraE4ObeM5W7uXhU+O64q9Qe00XBR/\n\tkLsqCY7M5M9AA==","Date":"Thu, 30 Jan 2025 11:51:46 +0000","To":"libcamera-devel@lists.libcamera.org","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Subject":"[RFC PATCH v3 20/21] apps: lc-compliance: Make `EventLoop` a member","Message-ID":"<20250130115001.1129305-21-pobrn@protonmail.com>","In-Reply-To":"<20250130115001.1129305-1-pobrn@protonmail.com>","References":"<20250130115001.1129305-1-pobrn@protonmail.com>","Feedback-ID":"20568564:user:proton","X-Pm-Message-ID":"c75102745a46ba28d74340cc42d24cd31efd7f87","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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":"Instead of creating an `EventLoop` in each `run()` invocation\nand setting a member pointer to the on-stack object, simply\nmake it a member variable.\n\nSigned-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n---\n src/apps/lc-compliance/helpers/capture.cpp | 11 ++++-------\n src/apps/lc-compliance/helpers/capture.h   |  2 +-\n 2 files changed, 5 insertions(+), 8 deletions(-)","diff":"diff --git a/src/apps/lc-compliance/helpers/capture.cpp b/src/apps/lc-compliance/helpers/capture.cpp\nindex 5032470d9..13a5e3f33 100644\n--- a/src/apps/lc-compliance/helpers/capture.cpp\n+++ b/src/apps/lc-compliance/helpers/capture.cpp\n@@ -69,16 +69,13 @@ void Capture::run(unsigned int captureLimit, std::optional<unsigned int> queueLi\n \n \tcaptureCount_ = queueCount_ = 0;\n \n-\tEventLoop loop;\n-\tloop_ = &loop;\n-\n \tstart();\n \tprepareRequests();\n \n \tfor (const auto &request : requests_)\n \t\tqueueRequest(request.get());\n \n-\tEXPECT_EQ(loop_->exec(), 0);\n+\tEXPECT_EQ(loop_.exec(), 0);\n \n \tstop();\n \n@@ -140,7 +137,7 @@ void Capture::requestComplete(Request *request)\n {\n \tcaptureCount_++;\n \tif (captureCount_ >= captureLimit_) {\n-\t\tloop_->exit(0);\n+\t\tloop_.exit(0);\n \t\treturn;\n \t}\n \n@@ -170,7 +167,7 @@ void Capture::start()\n \tcamera_->requestCompleted.connect(this, [this](libcamera::Request *request) {\n \t\t/* Runs in the CameraManager thread. */\n \n-\t\tloop_->callLater([this, request] {\n+\t\tloop_.callLater([this, request] {\n \t\t\t/* Run handler in the context of the event loop. */\n \t\t\trequestComplete(request);\n \t\t}, reinterpret_cast<std::uintptr_t>(this));\n@@ -190,7 +187,7 @@ void Capture::stop()\n \n \trequests_.clear();\n \n-\tloop_->cancelLater(reinterpret_cast<std::uintptr_t>(this));\n+\tloop_.cancelLater(reinterpret_cast<std::uintptr_t>(this));\n \n \tfor (const auto &cfg : *config_) {\n \t\tint ret = allocator_.free(cfg.stream());\ndiff --git a/src/apps/lc-compliance/helpers/capture.h b/src/apps/lc-compliance/helpers/capture.h\nindex dacce1fe2..50dc37c28 100644\n--- a/src/apps/lc-compliance/helpers/capture.h\n+++ b/src/apps/lc-compliance/helpers/capture.h\n@@ -38,7 +38,7 @@ private:\n \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n \tstd::vector<std::unique_ptr<libcamera::Request>> requests_;\n \n-\tEventLoop *loop_ = nullptr;\n+\tEventLoop loop_;\n \tunsigned int captureLimit_ = 0;\n \tstd::optional<unsigned int> queueLimit_;\n \tunsigned int captureCount_ = 0;\n","prefixes":["RFC","v3","20/21"]}