Show a patch.

GET /api/1.1/patches/10558/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 10558,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/10558/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10558/",
    "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": "<20201204143955.294320-1-jacopo@jmondi.org>",
    "date": "2020-12-04T14:39:55",
    "name": "[libcamera-devel] android: camera_device: Stop camera when re-configuring it",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0290bae9dacf68ffaceae73a8b9fc78863bb39d9",
    "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/10558/mbox/",
    "series": [
        {
            "id": 1504,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1504/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1504",
            "date": "2020-12-04T14:39:55",
            "name": "[libcamera-devel] android: camera_device: Stop camera when re-configuring it",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1504/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10558/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10558/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 C56D8BE176\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  4 Dec 2020 14:39:54 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4F48F635DE;\n\tFri,  4 Dec 2020 15:39:54 +0100 (CET)",
            "from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 318CF635D0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  4 Dec 2020 15:39:53 +0100 (CET)",
            "from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id D7111C0006\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  4 Dec 2020 14:39:52 +0000 (UTC)"
        ],
        "X-Originating-IP": "93.34.118.233",
        "From": "Jacopo Mondi <jacopo@jmondi.org>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  4 Dec 2020 15:39:55 +0100",
        "Message-Id": "<20201204143955.294320-1-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.29.1",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH] android: camera_device: Stop camera when\n\tre-configuring it",
        "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": "The Android camera device HAL3 specification does not require a\ncamera to go through any explicit close() call between configurations.\nIt is legit for a camera to be configured, a number of requests\nprocessed and the re-configured again without any explicit stop.\n\nThe libcamera Android camera HAL starts the Camera at the first handled\nrequest, and only stops it at camera close time. This mean, that two\ncamera configuration attempts part of the same streaming session are only\ninterleaved by capture requests handling.\n\nThe libcamera::Camera state machine requires the Camera to be stopped,\nbefore any configuration take place, and this currently doesn't happen\nin the camera HAL CameraDevice class.\n\nFix this by stopping the camera and the associated worker thread if\na configuration attempt is performed while the Camera is in running\nstate.\n\nThis patch fixes cros_camera_test:\nCamera3PreviewTest/Camera3SinglePreviewTest.Camera3BasicPreviewTest/0\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\n---\nAlternatively, the camera can be stopped at the very beginning of the\nconfigureStream() function. But in that case the camera gets stopped\neven if the configuration attempt fails (ie at validation time).\n\nAs both behaviour seems to be compliant with what Android expects, I decided\nto stop the camera only if the configuration is valid.\n---\n\n src/android/camera_device.cpp | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)\n\n--\n2.29.1",
    "diff": "diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 675af5705055..2500994e2f6a 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1341,8 +1341,15 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n\n \t/*\n \t * Once the CameraConfiguration has been adjusted/validated\n-\t * it can be applied to the camera.\n+\t * it can be applied to the camera, which has to be stopped if\n+\t * in running state.\n \t */\n+\tif (running_) {\n+\t\tworker_.stop();\n+\t\tcamera_->stop();\n+\t\trunning_ = false;\n+\t}\n+\n \tint ret = camera_->configure(config_.get());\n \tif (ret) {\n \t\tLOG(HAL, Error) << \"Failed to configure camera '\"\n",
    "prefixes": [
        "libcamera-devel"
    ]
}