{"id":22167,"url":"https://patchwork.libcamera.org/api/patches/22167/?format=json","web_url":"https://patchwork.libcamera.org/patch/22167/","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":"<20241204164137.3938891-6-chenghaoyang@chromium.org>","date":"2024-12-04T16:36:30","name":"[v3,5/7] android: Drop notify CAMERA3_MSG_ERROR_REQUEST when a request fails","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"02a634b6d50cdd495ad3ced5695d9db6d9279e5e","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22167/mbox/","series":[{"id":4847,"url":"https://patchwork.libcamera.org/api/series/4847/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4847","date":"2024-12-04T16:36:25","name":"Refactor Android HAL before supporting partial result","version":3,"mbox":"https://patchwork.libcamera.org/series/4847/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22167/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22167/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 2827EBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  4 Dec 2024 16:42:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5E51A660F1;\n\tWed,  4 Dec 2024 17:41:58 +0100 (CET)","from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com\n\t[IPv6:2607:f8b0:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4FB62660CE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  4 Dec 2024 17:41:53 +0100 (CET)","by mail-pf1-x42d.google.com with SMTP id\n\td2e1a72fcca58-724f0f6300aso16057b3a.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 04 Dec 2024 08:41:53 -0800 (PST)","from chenghaoyang-low.c.googlers.com.com\n\t(112.212.229.35.bc.googleusercontent.com. [35.229.212.112])\n\tby smtp.gmail.com with ESMTPSA id\n\td2e1a72fcca58-725417725e9sm12551779b3a.80.2024.12.04.08.41.48\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 04 Dec 2024 08:41:49 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"jmk5/kHa\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1733330510; x=1733935310;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=CC96l7K+Y3IIaBzL/E1qpGzpDcR7HOUllb+44i9I0Z4=;\n\tb=jmk5/kHaFoBwiydYFw86uQDU404+4I0Zw/nmg8sJ4o6WEiTEATLRshe1tN2O0lyvHv\n\twaHvrEzHcwFuor49BpRqjWA9sUlAfujcEOrWCHnjCM7na3HXo0R12hyXdoubvYnMI9Y9\n\t4GgCSkvnIsiO9uzN8HsKArywhcgoQFkOU2VUA=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1733330510; x=1733935310;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from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3mtNTT/K3AQXsOE5RVBXtA7A==","X-Received":"by 2002:a05:6a00:92a7:b0:725:996c:3a16 with SMTP id\n\td2e1a72fcca58-725996c3e4cmr1836681b3a.13.1733330509824; \n\tWed, 04 Dec 2024 08:41:49 -0800 (PST)","From":"Harvey Yang <chenghaoyang@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"Harvey Yang <chenghaoyang@chromium.org>,\n\tHan-Lin Chen <hanlinchen@chromium.org>","Subject":"[PATCH v3 5/7] android: Drop notify CAMERA3_MSG_ERROR_REQUEST when a\n\trequest fails","Date":"Wed,  4 Dec 2024 16:36:30 +0000","Message-ID":"<20241204164137.3938891-6-chenghaoyang@chromium.org>","X-Mailer":"git-send-email 2.47.0.338.g60cca15819-goog","In-Reply-To":"<20241204164137.3938891-1-chenghaoyang@chromium.org>","References":"<20241204164137.3938891-1-chenghaoyang@chromium.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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":"According to Android Camera API v3.2, CAMERA3_MSG_ERROR_REQUEST is used\nfor requests that have not done any processing. When a request is\ncompleted with failure, CAMERA3_MSG_ERROR_RESULT should be used instead.\n\nTo avoid code duplication, when CameraMetadata cannot be generated,\nCAMERA3_MSG_ERROR_RESULT is notified after process_capture_result.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@chromium.org>\nCo-developed-by: Harvey Yang <chenghaoyang@chromium.org>\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n src/android/camera_device.cpp | 17 ++++++++++++-----\n 1 file changed, 12 insertions(+), 5 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 497d363d6..dd2c603e0 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1211,10 +1211,7 @@ void CameraDevice::requestComplete(Request *request)\n \t\t\t\t<< \" not successfully completed: \"\n \t\t\t\t<< request->status();\n \n-\t\tabortRequest(descriptor);\n-\t\tcompleteDescriptor(descriptor);\n-\n-\t\treturn;\n+\t\tdescriptor->status_ = Camera3RequestDescriptor::Status::Error;\n \t}\n \n \t/*\n@@ -1239,7 +1236,7 @@ void CameraDevice::requestComplete(Request *request)\n \t */\n \tdescriptor->resultMetadata_ = getResultMetadata(*descriptor);\n \tif (!descriptor->resultMetadata_) {\n-\t\tnotifyError(descriptor->frameNumber_, nullptr, CAMERA3_MSG_ERROR_RESULT);\n+\t\tdescriptor->status_ = Camera3RequestDescriptor::Status::Error;\n \n \t\t/*\n \t\t * The camera framework expects an empty metadata pack on error.\n@@ -1325,6 +1322,16 @@ void CameraDevice::sendCaptureResults()\n \t\tdescriptors_.pop();\n \n \t\tsendCaptureResult(descriptor.get());\n+\n+\t\t/*\n+\t\t * Call notify with CAMERA3_MSG_ERROR_RESULT to indicate some\n+\t\t * of the expected result metadata might not be available\n+\t\t * because the capture is cancelled by the camera. Only notify\n+\t\t * it when the final result is sent, since Android will ignore\n+\t\t * the following metadata.\n+\t\t */\n+\t\tif (descriptor->status_ == Camera3RequestDescriptor::Status::Error)\n+\t\t\tnotifyError(descriptor->frameNumber_, nullptr, CAMERA3_MSG_ERROR_RESULT);\n \t}\n }\n \n","prefixes":["v3","5/7"]}