{"id":11764,"url":"https://patchwork.libcamera.org/api/patches/11764/?format=json","web_url":"https://patchwork.libcamera.org/patch/11764/","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":"<20210329091552.157208-4-hiroh@chromium.org>","date":"2021-03-29T09:15:52","name":"[libcamera-devel,v2,3/3] Regard a request error in the request completion","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"f748eab130c2741376d2b544f62de9287456a1ee","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11764/mbox/","series":[{"id":1860,"url":"https://patchwork.libcamera.org/api/series/1860/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1860","date":"2021-03-29T09:15:49","name":"Add RequestError to Request::Status","version":2,"mbox":"https://patchwork.libcamera.org/series/1860/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11764/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11764/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 D172DC32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Mar 2021 09:16:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6E9986878A;\n\tMon, 29 Mar 2021 11:16:08 +0200 (CEST)","from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com\n\t[IPv6:2607:f8b0:4864:20::1033])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 30EE46877F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Mar 2021 11:16:04 +0200 (CEST)","by mail-pj1-x1033.google.com with SMTP id\n\tcl21-20020a17090af695b02900c61ac0f0e9so7890640pjb.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Mar 2021 02:16:04 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:1db7:ae60:9288:b906])\n\tby smtp.gmail.com with ESMTPSA id\n\tn2sm15818122pga.57.2021.03.29.02.16.01\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 29 Mar 2021 02:16:02 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"c3O/PQFz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=F/R/Bikvglu/rqZgcIYTTJBemVCr6U4EhBeOlf3PuO4=;\n\tb=c3O/PQFzYMLQpfD7HAXz2Squ4O+F1OeDHLEb/9NqLF/fMi9Fo7ysLi+beeO7q/zv5e\n\trTswXxZGonRR6um6wvLoxuDt/wcb9sYvhLDBWtgLCN6SPHUjDj9LEn4xQP9Sw+4NPg64\n\tAGKFNshvJOhk3g75Ga26a6Q/rCoZPVYzP/Gvk=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=F/R/Bikvglu/rqZgcIYTTJBemVCr6U4EhBeOlf3PuO4=;\n\tb=nRJnCqIl8Zj5dL+Aq8SoDVzdSNYwfAmigc5bG7ibY6vUd8RlesK07zTcJOeXh1exRk\n\txN8DU3jvCuCimJTknmnOdSkM0VypbbAEJ6XI1kHbEw8s+kXeFw+LpZNl44jNAtmwpmnI\n\twmcg9rYHfZIZkaomML+bckhCsGEMuAWx7vjit8cRazoFAZxyTwWvOQwn/jRzbRUP3wDz\n\thHztcmYJuMNeiZYBrw3dl+eJb+fXK6l36zU6y4UM0gmnM+uIvY8cVJG76Yj27iEYCHQK\n\tR0kxVG+bNd4xL8GaV4rWWYNtYyOJPUAXtlyFoJianTmUxmEhml2jTwcWrDO50bfb94Mp\n\tJCuQ==","X-Gm-Message-State":"AOAM531w2CEFka+8lWjbHwCaK6kcCoTvUKSMv8i3OlwRX1abWTzB4BOm\n\tLEtr7ELF0FCRcn4KhW+OPB5o2Cp9GV4U/A==","X-Google-Smtp-Source":"ABdhPJwZv9kf4f9SJ/MJ2frPPpefoFTNI9ZjxyX8qTitmiqERf2m28HyzoddFE9kDsXxbM7FC10dzA==","X-Received":"by 2002:a17:90a:5d09:: with SMTP id\n\ts9mr25174803pji.228.1617009362647; \n\tMon, 29 Mar 2021 02:16:02 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 29 Mar 2021 18:15:52 +0900","Message-Id":"<20210329091552.157208-4-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.291.g576ba9dcdaf-goog","In-Reply-To":"<20210329091552.157208-1-hiroh@chromium.org>","References":"<20210329091552.157208-1-hiroh@chromium.org>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 3/3] Regard a request error in the\n\trequest completion","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":"libcamera::Request contains an error value. Every\nlibcamera::Camera client should regards the error in a\nrequest completion.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n Documentation/guides/application-developer.rst | 2 ++\n src/cam/capture.cpp                            | 5 +++++\n src/gstreamer/gstlibcamerasrc.cpp              | 6 +++++-\n src/qcam/main_window.cpp                       | 4 ++++\n src/v4l2/v4l2_camera.cpp                       | 5 +++++\n 5 files changed, 21 insertions(+), 1 deletion(-)","diff":"diff --git a/Documentation/guides/application-developer.rst b/Documentation/guides/application-developer.rst\nindex e3430f03..e8a1a7b4 100644\n--- a/Documentation/guides/application-developer.rst\n+++ b/Documentation/guides/application-developer.rst\n@@ -392,6 +392,8 @@ the `Request::Status`_ class enum documentation.\n \n    if (request->status() == Request::RequestCancelled)\n       return;\n+   if (request->status() == Request::RequestError)\n+      // handle error.\n \n If the ``Request`` has completed successfully, applications can access the\n completed buffers using the ``Request::buffers()`` function, which returns a map\ndiff --git a/src/cam/capture.cpp b/src/cam/capture.cpp\nindex 7b55fc67..3e9edf80 100644\n--- a/src/cam/capture.cpp\n+++ b/src/cam/capture.cpp\n@@ -167,6 +167,11 @@ void Capture::requestComplete(Request *request)\n {\n \tif (request->status() == Request::RequestCancelled)\n \t\treturn;\n+\t/* TODO: Handle an error correctly */\n+\tif (request->status() == Request::RequestError) {\n+\t\tstd::cout << \"Failed to capture request: \" << request->cookie();\n+\t\treturn;\n+\t}\n \n \t/*\n \t * Defer processing of the completed request to the event loop, to avoid\ndiff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 87246b40..1ecb9883 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -163,10 +163,14 @@ GstLibcameraSrcState::requestCompleted(Request *request)\n \n \tg_return_if_fail(wrap->request_.get() == request);\n \n-\tif ((request->status() == Request::RequestCancelled)) {\n+\tif (request->status() == Request::RequestCancelled) {\n \t\tGST_DEBUG_OBJECT(src_, \"Request was cancelled\");\n \t\treturn;\n \t}\n+\tif (request->status() == Request::RequestError) {\n+\t\tGST_ERROR_OBJECT(src_, \"Request doesn't complete successfully\");\n+\t\treturn;\n+\t}\n \n \tGstBuffer *buffer;\n \tfor (GstPad *srcpad : srcpads_) {\ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 39d034de..1288bcd5 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -694,6 +694,10 @@ void MainWindow::requestComplete(Request *request)\n {\n \tif (request->status() == Request::RequestCancelled)\n \t\treturn;\n+\tif (request->status() == Request::RequestError) {\n+\t\tqCritical() << \"Request doesn't complete successfully\";\n+\t\treturn;\n+\t}\n \n \t/*\n \t * We're running in the libcamera thread context, expensive operations\ndiff --git a/src/v4l2/v4l2_camera.cpp b/src/v4l2/v4l2_camera.cpp\nindex 97825c71..d6b1d755 100644\n--- a/src/v4l2/v4l2_camera.cpp\n+++ b/src/v4l2/v4l2_camera.cpp\n@@ -84,6 +84,11 @@ void V4L2Camera::requestComplete(Request *request)\n {\n \tif (request->status() == Request::RequestCancelled)\n \t\treturn;\n+\tif (request->status() == Request::RequestError) {\n+\t\tLOG(V4L2Compat, Error)\n+\t\t\t<< \"Request doesn't complete successfully\";\n+\t\treturn;\n+\t}\n \n \t/* We only have one stream at the moment. */\n \tbufferLock_.lock();\n","prefixes":["libcamera-devel","v2","3/3"]}