From patchwork Mon Mar 29 00:27:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11751 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 DEBD2C32EE for ; Mon, 29 Mar 2021 00:27:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9D02168788; Mon, 29 Mar 2021 02:27:27 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="CoOYxXVV"; dkim-atps=neutral Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 14783602D7 for ; Mon, 29 Mar 2021 02:27:26 +0200 (CEST) Received: by mail-pj1-x1032.google.com with SMTP id kk2-20020a17090b4a02b02900c777aa746fso5091397pjb.3 for ; Sun, 28 Mar 2021 17:27:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IPfuHldJe8ZsSTLGeouvJnaaAIQJGOTMnvYwGW9M4iY=; b=CoOYxXVV0mobvWfZbzAY6zJVfYBTGf/mq8aITnEflWL5gXBESksi6IwFYz1D0PvW72 +sL0MCHqG0uUNs/xWiMde0cDjzAMqH85XVTuHGY1zGw+vI9RJas07YCRHGHdoPkALiul Pdyg2P3sZLYqi8WurxGR4auipoOGA2nS5VMqs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IPfuHldJe8ZsSTLGeouvJnaaAIQJGOTMnvYwGW9M4iY=; b=Yzu0W20TfNv2YHJnc+6hzBshzljieCVbRFGcxT7v7Cq5qHl1XHDB2HlxEsfvcbFI3u sGoGwZCzQsKjvV8AVqi7vKUIl9bVL6AKsHT56U2F35PkGzSRIZvlfNiTCTLoMaJJDF22 CMm+dP2IHsqyw0p2Xfn6JY8VfUd4yF+UhUgsiiAWgn9lIfAD1NAQIlIVaSFJfBEP/rJU Dj+84PHAcDIXOYmALGNEZAiJWKXyPVGU1WsYClso9EgJRL/uePZJwGL1odmMOMoD99at q46j66R6T/WaG4CQsdhuMcqYNpBqOwLxbuDItkBi2auN3NSD6PNoIM+SpBVvARWpLQm0 RRuw== X-Gm-Message-State: AOAM533DY1G5KP2b97m3nOR93GyeQb0yBEXNtGz8ahbw1kxvyjMkyE1I zxMAspAm4ik7QFAua+/AZa0h8ba2I5pS6g== X-Google-Smtp-Source: ABdhPJyvtzSu7p3YduSl9MVA4mZsFQ9ubVwTJL1bF9nj4wqJ4RJZzkBEYT1oNI9fJN1zOFvjKw1yoA== X-Received: by 2002:a17:902:c408:b029:e7:3242:5690 with SMTP id k8-20020a170902c408b02900e732425690mr14074350plk.85.1616977644576; Sun, 28 Mar 2021 17:27:24 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:1db7:ae60:9288:b906]) by smtp.gmail.com with ESMTPSA id j188sm15227209pfd.64.2021.03.28.17.27.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Mar 2021 17:27:24 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Mon, 29 Mar 2021 09:27:13 +0900 Message-Id: <20210329002715.74403-2-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210329002715.74403-1-hiroh@chromium.org> References: <20210329002715.74403-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] libcamera: PipelineHandler: Make queueRequest() void function 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" PipelineHandler::queueRequest() is asynchronously invoked in Camera::queueRequest(). Therefore the return value of PipelineHandler::queueRequest() is useless. This changes the function to a void function. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart --- include/libcamera/internal/pipeline_handler.h | 2 +- src/libcamera/camera.cpp | 6 ++++-- src/libcamera/pipeline_handler.cpp | 4 +--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index 6aca0b46..093b94c6 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -79,7 +79,7 @@ public: virtual int start(Camera *camera, const ControlList *controls) = 0; virtual void stop(Camera *camera) = 0; - int queueRequest(Request *request); + void queueRequest(Request *request); bool completeBuffer(Request *request, FrameBuffer *buffer); void completeRequest(Request *request); diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 84edbb8f..2611c701 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -996,8 +996,10 @@ int Camera::queueRequest(Request *request) } } - return d->pipe_->invokeMethod(&PipelineHandler::queueRequest, - ConnectionTypeQueued, request); + d->pipe_->invokeMethod(&PipelineHandler::queueRequest, + ConnectionTypeQueued, request); + + return 0; } /** diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index d22991d3..05b807d6 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -374,7 +374,7 @@ const ControlList &PipelineHandler::properties(const Camera *camera) const * * \return 0 on success or a negative error code otherwise */ -int PipelineHandler::queueRequest(Request *request) +void PipelineHandler::queueRequest(Request *request) { LIBCAMERA_TRACEPOINT(request_queue, request); @@ -385,8 +385,6 @@ int PipelineHandler::queueRequest(Request *request) int ret = queueRequestDevice(camera, request); if (ret) data->queuedRequests_.remove(request); - - return ret; } /** From patchwork Mon Mar 29 00:27:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11752 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 38C12C32ED for ; Mon, 29 Mar 2021 00:27:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EA8FD6878B; Mon, 29 Mar 2021 02:27:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="AYzK/x21"; dkim-atps=neutral Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 76D626877C for ; Mon, 29 Mar 2021 02:27:27 +0200 (CEST) Received: by mail-pl1-x62a.google.com with SMTP id g10so3577665plt.8 for ; Sun, 28 Mar 2021 17:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wdPP1Ko5IWsl0/+XDtJ9kFAPZim+486TEQ9K9uaCUEo=; b=AYzK/x212EgUM4i2AawObJZJp4w4XkD5R54CXIBkyQ+Jk1JNb8BksXJRWnd6c9rLjY buzC4o7QXXs88d/mX7YX+qRLJ9mVSyaZ6ZWFqgRITWsBvlZxx7Pz9HnwQXryZwAq9Y+R 6mbF5eV1HfWMVFEvOfaepyF2epPsh2eZPlCBM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wdPP1Ko5IWsl0/+XDtJ9kFAPZim+486TEQ9K9uaCUEo=; b=iBCwhCFuqTQl+P0JXqhWNxymKjmwS2a9Con0AxBmTU1tXIJkHCZiDME6WNbzV4WyXm Gvn9nYop4PqL/Sin5c+wL229d0+Wb7dnVu00FgvuFIrf53/4Kf4Xdq1lX2lg2fGsCCzK R9IPlMOob/Q8NNVKM2ru5iYqdR9G4tQ70ysWKti4zmfLply+oPUWh71A55Ns3NRpuWeV N4+xaa+aoVckS8GpDXl+A2IF1PD5rK4ZLOGT1Qkz5LwPkvm0EF+EvjTQzE44G6lBdy2P GARLpPbwGedskOuQNKbXTcq+V0N0J2x9aXDWAYjRhserhthslzm+/3FN9x4MAoZAmCd7 8DQw== X-Gm-Message-State: AOAM532qLHVugWHkf9P2oXmHADUGYtlDHMtggUEkeT1XUAmRy94IsLHm eYxGoGdPAhOuqZQ56JHBOAeHFyEDV0EwRQ== X-Google-Smtp-Source: ABdhPJzSzsQfwDWfIZwXsBNfys2eg/f8vIsrubw3VMNG7wLFTrTTwRWb9abBD3GgI44RGhFtq7HZuw== X-Received: by 2002:a17:902:a9c2:b029:e7:147f:76a1 with SMTP id b2-20020a170902a9c2b02900e7147f76a1mr21486022plr.5.1616977645973; Sun, 28 Mar 2021 17:27:25 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:1db7:ae60:9288:b906]) by smtp.gmail.com with ESMTPSA id j188sm15227209pfd.64.2021.03.28.17.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Mar 2021 17:27:25 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Mon, 29 Mar 2021 09:27:14 +0900 Message-Id: <20210329002715.74403-3-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210329002715.74403-1-hiroh@chromium.org> References: <20210329002715.74403-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] libcamera: Request: Add an error value 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" libcamera::Request returned by Camera::requestComplete() is always assumed. Therefore, an error occurred in PipelineHandler::queueRequest() is ignored. This adds an error value, which is zero on success, to libcamera::Request() so that a Camera client can know the request error in completing request. Signed-off-by: Hirokazu Honda --- include/libcamera/request.h | 2 ++ src/libcamera/pipeline_handler.cpp | 6 ++++-- src/libcamera/request.cpp | 21 ++++++++++++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/include/libcamera/request.h b/include/libcamera/request.h index 6e5aad5f..60e91d5f 100644 --- a/include/libcamera/request.h +++ b/include/libcamera/request.h @@ -52,6 +52,7 @@ public: uint64_t cookie() const { return cookie_; } Status status() const { return status_; } + int result() const { return result_; } bool hasPendingBuffers() const { return !pending_.empty(); } @@ -73,6 +74,7 @@ private: const uint64_t cookie_; Status status_; + int result_; bool cancelled_; }; diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 05b807d6..a9a5523b 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -383,8 +383,10 @@ void PipelineHandler::queueRequest(Request *request) data->queuedRequests_.push_back(request); int ret = queueRequestDevice(camera, request); - if (ret) - data->queuedRequests_.remove(request); + if (ret) { + request->result_ = ret; + completeRequest(request); + } } /** diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index 0071667e..8106437e 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -72,7 +72,7 @@ LOG_DEFINE_CATEGORY(Request) * */ Request::Request(Camera *camera, uint64_t cookie) - : camera_(camera), cookie_(cookie), status_(RequestPending), + : camera_(camera), cookie_(cookie), status_(RequestPending), result_(0), cancelled_(false) { /** @@ -236,15 +236,26 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const * \fn Request::status() * \brief Retrieve the request completion status * - * The request status indicates whether the request has completed successfully - * or with an error. When requests are created and before they complete the - * request status is set to RequestPending, and is updated at completion time - * to RequestComplete. If a request is cancelled at capture stop before it has + * The request status indicates whether the request has pended, completed or + * cancelled.. When requests are created and before they complete the request + * status is set to RequestPending, and is updated at completion time to + * RequestComplete. If a request is cancelled at capture stop before it has * completed, its status is set to RequestCancelled. * * \return The request completion status */ +/** + * \fn Request::result() + * \brief Retrieve the error value of the request . + * + * The request error indicates whether the request has completed successfully or + * with an error. It is a negative value if an error happens in queueing and + * processing the request, or 0 on success. + * + * \return The request error value. + */ + /** * \fn Request::hasPendingBuffers() * \brief Check if a request has buffers yet to be completed From patchwork Mon Mar 29 00:27:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11753 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 A583CC32ED for ; Mon, 29 Mar 2021 00:27:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 615FB68784; Mon, 29 Mar 2021 02:27:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="jeJ01GXy"; dkim-atps=neutral Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 473CD602D2 for ; Mon, 29 Mar 2021 02:27:29 +0200 (CEST) Received: by mail-pl1-x634.google.com with SMTP id l1so3573470plg.12 for ; Sun, 28 Mar 2021 17:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qN4zyYtjze+RpnIPIXlkhNzNPt6huMpyeir3TFZj5MU=; b=jeJ01GXy7v9UaPcTs8rgCvKr/4rJTdUsxpB1P2BPZ8DCi4xKogd+HJFhxNQHKw76c7 ykxk8/5ANXocIVLZVEzTKHDsULh8pxSozl4LRx8e5Md13bda3u9TOtt6/xdK1rWwpVJR hqMumJCkWMxX11mZ2nIrr18L0APwF3uaQzFhk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qN4zyYtjze+RpnIPIXlkhNzNPt6huMpyeir3TFZj5MU=; b=Wxv4Uvgmx7Ki0rAdVduJBSSexcBs94c/3DVIjwQV75WYVD3EWEcmxNzZQCih7q9WGe 0O6dpkr4Ppp8pr11iC6SMxiWQXXVpvbpe+4CYkdVDB+XkTOLa7NHyXJzWfA6jz4AzvXe aesCxv3fGwbVB8Cj+OkiCB4+1mHXbXcdQtfHRkt5w4BWBtmUZAwwAsA4RpKwBiAIANL1 ynjnX3FILIjHjYMRDm5ESqEM5jZhPnmusyelNGVgZxd5UyWZO5nams8S30GT7V25h3PB YkZ5lCLMQFV5EgZssA3RDSbFW+bX+X1ZOgwac/7IWK134Jwmkp7DPb4Pf1hWs54SKDXE xAVA== X-Gm-Message-State: AOAM533XmsM8vNlgaly34GNpg81ByU7v6XHIn8R0N1em+TL5m5PK/e2H v7AyjNpzEfB+kNGA7yEBpnnyOpq0h3eseQ== X-Google-Smtp-Source: ABdhPJzGZXQ/V5PiDltlP5G0Ljpoj4pTWmm4JwVBY5GvJneqxOS/P4zScEy3SH9aMKzSIF5oeSeftw== X-Received: by 2002:a17:902:9897:b029:e6:f01d:9ca1 with SMTP id s23-20020a1709029897b02900e6f01d9ca1mr26443643plp.40.1616977647412; Sun, 28 Mar 2021 17:27:27 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:1db7:ae60:9288:b906]) by smtp.gmail.com with ESMTPSA id j188sm15227209pfd.64.2021.03.28.17.27.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Mar 2021 17:27:27 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Mon, 29 Mar 2021 09:27:15 +0900 Message-Id: <20210329002715.74403-4-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210329002715.74403-1-hiroh@chromium.org> References: <20210329002715.74403-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/3] Regard a request error in the request completion 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" libcamera::Request contains an error value. Every libcamera::Camera client should regards the error in a request completion. Signed-off-by: Hirokazu Honda --- Documentation/guides/application-developer.rst | 4 ++-- src/android/camera_device.cpp | 6 ++++-- src/cam/capture.cpp | 4 +++- src/gstreamer/gstlibcamerasrc.cpp | 4 ++++ src/qcam/main_window.cpp | 4 +++- src/v4l2/v4l2_camera.cpp | 4 +++- test/camera/buffer_import.cpp | 4 +++- test/camera/capture.cpp | 4 +++- 8 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst index e3430f03..d7232e7c 100644 --- a/Documentation/guides/application-developer.rst +++ b/Documentation/guides/application-developer.rst @@ -384,13 +384,13 @@ Request completion events can be emitted for requests which have been canceled, for example, by unexpected application shutdown. To avoid an application processing invalid image data, it’s worth checking that the request has completed successfully. The list of request completion statuses is available in -the `Request::Status`_ class enum documentation. +the `Request::Status`_ class enum documentation and `Request::result`_. .. _Request::Status: https://www.libcamera.org/api-html/classlibcamera_1_1Request.html#a2209ba8d51af8167b25f6e3e94d5c45b .. code:: cpp - if (request->status() == Request::RequestCancelled) + if (request->status() == Request::RequestCancelled || request->result() != 0) return; If the ``Request`` has completed successfully, applications can access the diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index ae693664..d02c1776 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1908,9 +1908,11 @@ void CameraDevice::requestComplete(Request *request) Camera3RequestDescriptor *descriptor = reinterpret_cast(request->cookie()); - if (request->status() != Request::RequestComplete) { + if (request->status() != Request::RequestComplete || + request->result() != 0) { LOG(HAL, Error) << "Request not successfully completed: " - << request->status(); + << "status=" << request->status() + << ", result=" << request->result(); status = CAMERA3_BUFFER_STATUS_ERROR; } diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp index 7b55fc67..24d0be32 100644 --- a/src/cam/capture.cpp +++ b/src/cam/capture.cpp @@ -165,8 +165,10 @@ int Capture::queueRequest(Request *request) void Capture::requestComplete(Request *request) { - if (request->status() == Request::RequestCancelled) + if (request->status() == Request::RequestCancelled || + request->result() != 0) { return; + } /* * Defer processing of the completed request to the event loop, to avoid diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp index 87246b40..b36ac33c 100644 --- a/src/gstreamer/gstlibcamerasrc.cpp +++ b/src/gstreamer/gstlibcamerasrc.cpp @@ -167,6 +167,10 @@ GstLibcameraSrcState::requestCompleted(Request *request) GST_DEBUG_OBJECT(src_, "Request was cancelled"); return; } + if (request->result() != 0) { + GST_DEBUG_OBJECT(src_, "Request was not completed successfully"); + return; + } GstBuffer *buffer; for (GstPad *srcpad : srcpads_) { diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 39d034de..f90310f9 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -692,8 +692,10 @@ void MainWindow::processRaw(FrameBuffer *buffer, void MainWindow::requestComplete(Request *request) { - if (request->status() == Request::RequestCancelled) + if (request->status() == Request::RequestCancelled || + request->result() != 0) { return; + } /* * We're running in the libcamera thread context, expensive operations diff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp index 97825c71..87153cd4 100644 --- a/src/v4l2/v4l2_camera.cpp +++ b/src/v4l2/v4l2_camera.cpp @@ -82,8 +82,10 @@ std::vector V4L2Camera::completedBuffers() void V4L2Camera::requestComplete(Request *request) { - if (request->status() == Request::RequestCancelled) + if (request->status() == Request::RequestCancelled || + request->result() != 0) { return; + } /* We only have one stream at the moment. */ bufferLock_.lock(); diff --git a/test/camera/buffer_import.cpp b/test/camera/buffer_import.cpp index 61f4eb92..8f4efa5e 100644 --- a/test/camera/buffer_import.cpp +++ b/test/camera/buffer_import.cpp @@ -47,8 +47,10 @@ protected: void requestComplete(Request *request) { - if (request->status() != Request::RequestComplete) + if (request->status() != Request::RequestComplete || + request->result() != 0) { return; + } const Request::BufferMap &buffers = request->buffers(); diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp index c4bc2110..6cff9bb4 100644 --- a/test/camera/capture.cpp +++ b/test/camera/capture.cpp @@ -43,8 +43,10 @@ protected: void requestComplete(Request *request) { - if (request->status() != Request::RequestComplete) + if (request->status() != Request::RequestComplete || + request->result() != 0) { return; + } const Request::BufferMap &buffers = request->buffers();