From patchwork Wed Dec 4 16:36:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-Hao Yang X-Patchwork-Id: 22167 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2827EBDB1C for ; Wed, 4 Dec 2024 16:42:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5E51A660F1; Wed, 4 Dec 2024 17:41:58 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="jmk5/kHa"; dkim-atps=neutral Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4FB62660CE for ; Wed, 4 Dec 2024 17:41:53 +0100 (CET) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-724f0f6300aso16057b3a.2 for ; Wed, 04 Dec 2024 08:41:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1733330510; x=1733935310; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CC96l7K+Y3IIaBzL/E1qpGzpDcR7HOUllb+44i9I0Z4=; b=jmk5/kHaFoBwiydYFw86uQDU404+4I0Zw/nmg8sJ4o6WEiTEATLRshe1tN2O0lyvHv waHvrEzHcwFuor49BpRqjWA9sUlAfujcEOrWCHnjCM7na3HXo0R12hyXdoubvYnMI9Y9 4GgCSkvnIsiO9uzN8HsKArywhcgoQFkOU2VUA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733330510; x=1733935310; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CC96l7K+Y3IIaBzL/E1qpGzpDcR7HOUllb+44i9I0Z4=; b=PB4Q6KLcovE68Iwdjy8aC4UnHCbKTIauuqTBVmDalE1DmwZBkH3x86Z2pm3AUxPtrK dnhD8hWU/BBFPH437iktcwfY3jl4dhDqA+ykxI79nbznNzeqeHJeoL1DZmIJ01oTZPt8 pXHfZP+neAT3nj6RpKq0a2hmaDiUuBIzTrV33MF1iLL7k6B+7qwkeT87dUdcSVQs3YGJ LV3D6yKW7xopjqEUrhUnAD4VRfdAy5j0tw9ebSXk/jKLnqq8gmVJem6ZOtXPhG12jnZI YYKNX6PdQO5WpvAgsFsF7bI8j1dsyh68Iddd4dPHL0HKd8f3R47GicWc7B8xs/Kfyv/w 9wZA== X-Gm-Message-State: AOJu0YymKiiDI//Re7GjPT6LfOTKEqIWxAfEBR6jeUIrwXxqsqxC0fdE c3/OCc3ZMG/tIEQqFKkO4sfTLbz6bdOn+XFKPZjZWQtM9Uc++VuHnEni2CjVdyDnhykhJVc5Q+o = X-Gm-Gg: ASbGncu74jGGTgzR7LoPpjTi/EdR5e6OIHlAsGWdImpsSrkPTpWqbNc/wp6fZ8lZ8Vj hXUj3dg/TQEypVyaIxQ8XCF8GwTsSCQdxuY0JdZH7OGlzkjGuUeGtu2FyCERzvruLXtMwen3s9O FoEY+f8ZYw40OgDf0MMRFvA7DimYkkZmR5MKWnqkdbrw+mugDLUDQrBQGB4gZ8MnSMVemttVp6Z 2XDDN2fKqbQ2dXL0PhCjsLs9QBXt+gczNbYr9BiO0VQIDPqkG4vYs3YTRUd+yttK7P+e5h4/Wx4 eYb+p2fIPcDPoDfZ/FPjM60NCziaEJaj0mocjnr680pCDLp+fdTafaFs X-Google-Smtp-Source: AGHT+IGIsZxEytTC18u9StxsGrQ2lIg5ZzB2dcCeMsKtfpSKuid0qJ3mtNTT/K3AQXsOE5RVBXtA7A== X-Received: by 2002:a05:6a00:92a7:b0:725:996c:3a16 with SMTP id d2e1a72fcca58-725996c3e4cmr1836681b3a.13.1733330509824; Wed, 04 Dec 2024 08:41:49 -0800 (PST) Received: from chenghaoyang-low.c.googlers.com.com (112.212.229.35.bc.googleusercontent.com. [35.229.212.112]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-725417725e9sm12551779b3a.80.2024.12.04.08.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2024 08:41:49 -0800 (PST) From: Harvey Yang To: libcamera-devel@lists.libcamera.org Cc: Harvey Yang , Han-Lin Chen Subject: [PATCH v3 5/7] android: Drop notify CAMERA3_MSG_ERROR_REQUEST when a request 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 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" According to Android Camera API v3.2, CAMERA3_MSG_ERROR_REQUEST is used for requests that have not done any processing. When a request is completed with failure, CAMERA3_MSG_ERROR_RESULT should be used instead. To avoid code duplication, when CameraMetadata cannot be generated, CAMERA3_MSG_ERROR_RESULT is notified after process_capture_result. Signed-off-by: Han-Lin Chen Co-developed-by: Harvey Yang Signed-off-by: Harvey Yang --- src/android/camera_device.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 497d363d6..dd2c603e0 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1211,10 +1211,7 @@ void CameraDevice::requestComplete(Request *request) << " not successfully completed: " << request->status(); - abortRequest(descriptor); - completeDescriptor(descriptor); - - return; + descriptor->status_ = Camera3RequestDescriptor::Status::Error; } /* @@ -1239,7 +1236,7 @@ void CameraDevice::requestComplete(Request *request) */ descriptor->resultMetadata_ = getResultMetadata(*descriptor); if (!descriptor->resultMetadata_) { - notifyError(descriptor->frameNumber_, nullptr, CAMERA3_MSG_ERROR_RESULT); + descriptor->status_ = Camera3RequestDescriptor::Status::Error; /* * The camera framework expects an empty metadata pack on error. @@ -1325,6 +1322,16 @@ void CameraDevice::sendCaptureResults() descriptors_.pop(); sendCaptureResult(descriptor.get()); + + /* + * Call notify with CAMERA3_MSG_ERROR_RESULT to indicate some + * of the expected result metadata might not be available + * because the capture is cancelled by the camera. Only notify + * it when the final result is sent, since Android will ignore + * the following metadata. + */ + if (descriptor->status_ == Camera3RequestDescriptor::Status::Error) + notifyError(descriptor->frameNumber_, nullptr, CAMERA3_MSG_ERROR_RESULT); } }