{"id":13752,"url":"https://patchwork.libcamera.org/api/patches/13752/?format=json","web_url":"https://patchwork.libcamera.org/patch/13752/","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":"<20210907195704.338079-4-umang.jain@ideasonboard.com>","date":"2021-09-07T19:57:01","name":"[libcamera-devel,v1,3/6] android: camera_stream: Notify process() status with a Signal","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"6c2ebbb506c231d0f3e28e34f15d4f2285ec0df4","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/?format=json","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"delegate":{"id":12,"url":"https://patchwork.libcamera.org/api/users/12/?format=json","username":"uajain","first_name":"Umang","last_name":"Jain","email":"umang.jain@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/13752/mbox/","series":[{"id":2493,"url":"https://patchwork.libcamera.org/api/series/2493/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2493","date":"2021-09-07T19:56:58","name":"Async post-processor","version":1,"mbox":"https://patchwork.libcamera.org/series/2493/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13752/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13752/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 DA058BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Sep 2021 19:57:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A4B746916E;\n\tTue,  7 Sep 2021 21:57:26 +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 ECD9C60252\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Sep 2021 21:57:24 +0200 (CEST)","from perceval.ideasonboard.com (unknown [103.251.226.2])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E36C9D88;\n\tTue,  7 Sep 2021 21:57:23 +0200 (CEST)"],"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=\"kFA1j+5w\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1631044644;\n\tbh=LLo3KFcpy9fTufkprpbPc2J3sbizubI4b06W+NKLmnI=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=kFA1j+5wzAhossj3MuoBO0JKSUPZmNRx88dEXDm7Bdd+I1GNNKZlJcHcgQGkIFhBO\n\teJ+I4DNjMTNbJXwQL0cuDuokAZ2oJe2gWzb++xEJDJ2gUC99yNzoCUgcuJATBcuYeK\n\tAKa98epRS2PK9PaXp0VLuD0EiR4RS955SMf06tUU=","From":"Umang Jain <umang.jain@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  8 Sep 2021 01:27:01 +0530","Message-Id":"<20210907195704.338079-4-umang.jain@ideasonboard.com>","X-Mailer":"git-send-email 2.31.1","In-Reply-To":"<20210907195704.338079-1-umang.jain@ideasonboard.com>","References":"<20210907195704.338079-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 3/6] android: camera_stream: Notify\n\tprocess() status with a Signal","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":"CameraStream takes care of any post-processing required via the\nCameraStream::process(). Since the post-processor will be moved\nto a separate thread (in subsequent commits), the caller of\nCameraStream::process() should be able to get notified about the\nstatus, in order to proceed further for completing the callbacks\nto android framework.\n\nTherefore, chain up to PostProcessor::processComplete signal in its\nsignal handler. Emit the corresponding CameraStream::PostProcessing value\naccording to the  PostProcessor::status received in the signal handler.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/android/camera_stream.cpp | 10 ++++++++++\n src/android/camera_stream.h   | 13 ++++++++++++-\n 2 files changed, 22 insertions(+), 1 deletion(-)","diff":"diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\nindex 0fed5382..81af53af 100644\n--- a/src/android/camera_stream.cpp\n+++ b/src/android/camera_stream.cpp\n@@ -81,6 +81,8 @@ int CameraStream::configure()\n \t\tint ret = postProcessor_->configure(configuration(), output);\n \t\tif (ret)\n \t\t\treturn ret;\n+\n+\t\tpostProcessor_->processComplete.connect(this, &CameraStream::handlePostProcessing);\n \t}\n \n \tif (allocator_) {\n@@ -121,6 +123,14 @@ int CameraStream::process(const FrameBuffer *source,\n \treturn postProcessor_->process(source, &dest, requestMetadata, resultMetadata);\n }\n \n+void CameraStream::handlePostProcessing(PostProcessor::Status status)\n+{\n+\tif (status == PostProcessor::Status::Success)\n+\t\tprocessComplete.emit(ProcessStatus::Success);\n+\telse\n+\t\tprocessComplete.emit(ProcessStatus::Failed);\n+}\n+\n FrameBuffer *CameraStream::getBuffer()\n {\n \tif (!allocator_)\ndiff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\nindex 5c232cb6..f9b11e5d 100644\n--- a/src/android/camera_stream.h\n+++ b/src/android/camera_stream.h\n@@ -13,15 +13,18 @@\n \n #include <hardware/camera3.h>\n \n+#include <libcamera/base/signal.h>\n+\n #include <libcamera/camera.h>\n #include <libcamera/framebuffer.h>\n #include <libcamera/framebuffer_allocator.h>\n #include <libcamera/geometry.h>\n #include <libcamera/pixel_format.h>\n \n+#include \"post_processor.h\"\n+\n class CameraDevice;\n class CameraMetadata;\n-class PostProcessor;\n \n class CameraStream\n {\n@@ -125,7 +128,15 @@ public:\n \tlibcamera::FrameBuffer *getBuffer();\n \tvoid putBuffer(libcamera::FrameBuffer *buffer);\n \n+\tenum ProcessStatus {\n+\t\tFailed,\n+\t\tSuccess,\n+\t};\n+\tlibcamera::Signal<ProcessStatus> processComplete;\n+\n private:\n+\tvoid handlePostProcessing(PostProcessor::Status status);\n+\n \tCameraDevice *const cameraDevice_;\n \tconst libcamera::CameraConfiguration *config_;\n \tconst Type type_;\n","prefixes":["libcamera-devel","v1","3/6"]}