Patch Detail
Show a patch.
GET /api/1.1/patches/12526/?format=api
{ "id": 12526, "url": "https://patchwork.libcamera.org/api/1.1/patches/12526/?format=api", "web_url": "https://patchwork.libcamera.org/patch/12526/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210608151633.73465-5-jacopo@jmondi.org>", "date": "2021-06-08T15:16:29", "name": "[libcamera-devel,v5,4/8] android: camera_device: Replace running_ with CameraState", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "8d221508e171983ba8c7ec98a28ec47a9d89a5d5", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/1.1/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": { "id": 15, "url": "https://patchwork.libcamera.org/api/1.1/users/15/?format=api", "username": "jmondi", "first_name": "Jacopo", "last_name": "Mondi", "email": "jacopo@jmondi.org" }, "mbox": "https://patchwork.libcamera.org/patch/12526/mbox/", "series": [ { "id": 2112, "url": "https://patchwork.libcamera.org/api/1.1/series/2112/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2112", "date": "2021-06-08T15:16:25", "name": "Implement flush() camera operation", "version": 5, "mbox": "https://patchwork.libcamera.org/series/2112/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/12526/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/12526/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 499ECC3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 8 Jun 2021 15:15:55 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E808D68934;\n\tTue, 8 Jun 2021 17:15:54 +0200 (CEST)", "from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A6F3F602A0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 8 Jun 2021 17:15:52 +0200 (CEST)", "(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 3F52460014;\n\tTue, 8 Jun 2021 15:15:51 +0000 (UTC)" ], "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 8 Jun 2021 17:16:29 +0200", "Message-Id": "<20210608151633.73465-5-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20210608151633.73465-1-jacopo@jmondi.org>", "References": "<20210608151633.73465-1-jacopo@jmondi.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v5 4/8] android: camera_device: Replace\n\trunning_ with CameraState", "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": "The CameraDevice class maintains the camera state in the 'running_'\nboolean flag to check if the camera has to be started at the first\nreceived process_capture_request() call which happens after the camera\nhad been stopped.\n\nSo far this was correct, as the operations that change the camera\ncould only start or stop the camera, so a simple boolean flag\nwas enough.\n\nTo prepare to handle the flush() operation that will introduce a new\n'flushing' state, replace the simple plain boolean flag with an\nenumeration of values that define the CameraState.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/android/camera_device.cpp | 10 +++++-----\n src/android/camera_device.h | 8 +++++++-\n 2 files changed, 12 insertions(+), 6 deletions(-)", "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex d7f24101b0d5..2c23366c578e 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -404,7 +404,7 @@ CameraDevice::Camera3RequestDescriptor::Camera3RequestDescriptor(\n */\n \n CameraDevice::CameraDevice(unsigned int id, std::shared_ptr<Camera> camera)\n-\t: id_(id), running_(false), camera_(std::move(camera)),\n+\t: id_(id), state_(State::Stopped), camera_(std::move(camera)),\n \t facing_(CAMERA_FACING_FRONT), orientation_(0)\n {\n \tcamera_->requestCompleted.connect(this, &CameraDevice::requestComplete);\n@@ -799,14 +799,14 @@ void CameraDevice::close()\n \n void CameraDevice::stop()\n {\n-\tif (!running_)\n+\tif (state_ == State::Stopped)\n \t\treturn;\n \n \tworker_.stop();\n \tcamera_->stop();\n \n \tdescriptors_.clear();\n-\trunning_ = false;\n+\tstate_ = State::Stopped;\n }\n \n void CameraDevice::setCallbacks(const camera3_callback_ops_t *callbacks)\n@@ -1900,7 +1900,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques\n \t\treturn -EINVAL;\n \n \t/* Start the camera if that's the first request we handle. */\n-\tif (!running_) {\n+\tif (state_ == State::Stopped) {\n \t\tworker_.start();\n \n \t\tint ret = camera_->start();\n@@ -1909,7 +1909,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques\n \t\t\treturn ret;\n \t\t}\n \n-\t\trunning_ = true;\n+\t\tstate_ = State::Running;\n \t}\n \n \t/*\ndiff --git a/src/android/camera_device.h b/src/android/camera_device.h\nindex decf175487e4..70c29755bcfc 100644\n--- a/src/android/camera_device.h\n+++ b/src/android/camera_device.h\n@@ -89,6 +89,11 @@ private:\n \t\tint androidFormat;\n \t};\n \n+\tenum class State {\n+\t\tStopped,\n+\t\tRunning,\n+\t};\n+\n \tvoid stop();\n \n \tint initializeStreamConfigurations();\n@@ -115,7 +120,8 @@ private:\n \n \tCameraWorker worker_;\n \n-\tbool running_;\n+\tState state_;\n+\n \tstd::shared_ptr<libcamera::Camera> camera_;\n \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n \n", "prefixes": [ "libcamera-devel", "v5", "4/8" ] }