[{"id":23626,"web_url":"https://patchwork.libcamera.org/comment/23626/","msgid":"<974b4a72f2c438a221cbbc48dc80aeaab338f247.camel@collabora.com>","date":"2022-06-27T21:13:30","subject":"Re: [libcamera-devel] [PATCH 08/13] gstreamer: Combine the two pad\n\tloops in the task run handler","submitter":{"id":31,"url":"https://patchwork.libcamera.org/api/people/31/","name":"Nicolas Dufresne","email":"nicolas.dufresne@collabora.com"},"content":"Hi Laurent,\n\nLe vendredi 24 juin 2022 à 02:22 +0300, Laurent Pinchart a écrit :\n> This simplifies the code, and allows removing the internal queue in the\n> GstLibcameraPad object.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nThanks for your patch.\n\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\n> ---\n>  src/gstreamer/gstlibcamerapad.cpp | 35 -------------------------------\n>  src/gstreamer/gstlibcamerapad.h   |  6 ------\n>  src/gstreamer/gstlibcamerasrc.cpp | 11 ++++------\n>  3 files changed, 4 insertions(+), 48 deletions(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp\n> index c00e81c8966e..87b4057ac101 100644\n> --- a/src/gstreamer/gstlibcamerapad.cpp\n> +++ b/src/gstreamer/gstlibcamerapad.cpp\n> @@ -18,7 +18,6 @@ struct _GstLibcameraPad {\n>  \tGstPad parent;\n>  \tStreamRole role;\n>  \tGstLibcameraPool *pool;\n> -\tGQueue pending_buffers;\n>  \tGstClockTime latency;\n>  };\n>  \n> @@ -155,40 +154,6 @@ gst_libcamera_pad_get_stream(GstPad *pad)\n>  \treturn nullptr;\n>  }\n>  \n> -void\n> -gst_libcamera_pad_queue_buffer(GstPad *pad, GstBuffer *buffer)\n> -{\n> -\tauto *self = GST_LIBCAMERA_PAD(pad);\n> -\tGLibLocker lock(GST_OBJECT(self));\n> -\n> -\tg_queue_push_head(&self->pending_buffers, buffer);\n> -}\n> -\n> -GstFlowReturn\n> -gst_libcamera_pad_push_pending(GstPad *pad)\n> -{\n> -\tauto *self = GST_LIBCAMERA_PAD(pad);\n> -\tGstBuffer *buffer;\n> -\n> -\t{\n> -\t\tGLibLocker lock(GST_OBJECT(self));\n> -\t\tbuffer = GST_BUFFER(g_queue_pop_tail(&self->pending_buffers));\n> -\t}\n> -\n> -\tif (!buffer)\n> -\t\treturn GST_FLOW_OK;\n> -\n> -\treturn gst_pad_push(pad, buffer);\n> -}\n> -\n> -bool\n> -gst_libcamera_pad_has_pending(GstPad *pad)\n> -{\n> -\tauto *self = GST_LIBCAMERA_PAD(pad);\n> -\tGLibLocker lock(GST_OBJECT(self));\n> -\treturn self->pending_buffers.length > 0;\n> -}\n> -\n>  void\n>  gst_libcamera_pad_set_latency(GstPad *pad, GstClockTime latency)\n>  {\n> diff --git a/src/gstreamer/gstlibcamerapad.h b/src/gstreamer/gstlibcamerapad.h\n> index 207695173313..103ee57ab384 100644\n> --- a/src/gstreamer/gstlibcamerapad.h\n> +++ b/src/gstreamer/gstlibcamerapad.h\n> @@ -25,10 +25,4 @@ void gst_libcamera_pad_set_pool(GstPad *pad, GstLibcameraPool *pool);\n>  \n>  libcamera::Stream *gst_libcamera_pad_get_stream(GstPad *pad);\n>  \n> -void gst_libcamera_pad_queue_buffer(GstPad *pad, GstBuffer *buffer);\n> -\n> -GstFlowReturn gst_libcamera_pad_push_pending(GstPad *pad);\n> -\n> -bool gst_libcamera_pad_has_pending(GstPad *pad);\n> -\n>  void gst_libcamera_pad_set_latency(GstPad *pad, GstClockTime latency);\n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> index ee9c83fde777..e30d45fa2223 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -311,6 +311,9 @@ gst_libcamera_src_task_run(gpointer user_data)\n>  \t\treturn;\n>  \t}\n>  \n> +\tGstFlowReturn ret = GST_FLOW_OK;\n> +\tgst_flow_combiner_reset(self->flow_combiner);\n> +\n>  \tfor (GstPad *srcpad : state->srcpads_) {\n>  \t\tStream *stream = gst_libcamera_pad_get_stream(srcpad);\n>  \t\tGstBuffer *buffer = wrap->detachBuffer(stream);\n> @@ -327,13 +330,7 @@ gst_libcamera_src_task_run(gpointer user_data)\n>  \t\tGST_BUFFER_OFFSET(buffer) = fb->metadata().sequence;\n>  \t\tGST_BUFFER_OFFSET_END(buffer) = fb->metadata().sequence;\n>  \n> -\t\tgst_libcamera_pad_queue_buffer(srcpad, buffer);\n> -\t}\n> -\n> -\tGstFlowReturn ret = GST_FLOW_OK;\n> -\tgst_flow_combiner_reset(self->flow_combiner);\n> -\tfor (GstPad *srcpad : state->srcpads_) {\n> -\t\tret = gst_libcamera_pad_push_pending(srcpad);\n> +\t\tret = gst_pad_push(srcpad, buffer);\n>  \t\tret = gst_flow_combiner_update_pad_flow(self->flow_combiner,\n>  \t\t\t\t\t\t\tsrcpad, ret);\n>  \t}","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 845DFBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jun 2022 21:13:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BFFD865635;\n\tMon, 27 Jun 2022 23:13:41 +0200 (CEST)","from madras.collabora.co.uk (madras.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8DC856059B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jun 2022 23:13:40 +0200 (CEST)","from nicolas-tpx395.localdomain (192-222-136-102.qc.cable.ebox.net\n\t[192.222.136.102])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested) (Authenticated sender: nicolas)\n\tby madras.collabora.co.uk (Postfix) with ESMTPSA id A5206660163E;\n\tMon, 27 Jun 2022 22:13:39 +0100 (BST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656364421;\n\tbh=4wfBwOzZZRoa3yWk4fikGGCn5bN1YxHFf4oUYO64xNE=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=HCj6I6mmKKWRVKgaNSNpGBH/M5r5uR6P5K7tRpk85Wvhuf2+gknxUcL977vU/6TCH\n\tJ+DbMckhvmysPX/+TgDqijr0Npk0dnXbVo2gNvWgIZ4VgKg07POeVryXar1skqEzMm\n\tCAb+CkJW08JpFlGG6P07+2AA66jOcI2UlxkefFc6uJs8vG5Hu/xYmksoKEl3GYKH65\n\tOudInus89EuO34NRbo+1IKIgwXEFbTOfVHWnSVoGj6WxyZWa3jLgejHyl2hc4F/RFl\n\tGwAcPGOs7fwOLU0ah9L/Cbc1Smqh7qJaolljRsLLNOSqqvoaemVMmsbDNbyvoWaAXH\n\t9wAK8amFGkB5Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com;\n\ts=mail; t=1656364420;\n\tbh=4wfBwOzZZRoa3yWk4fikGGCn5bN1YxHFf4oUYO64xNE=;\n\th=Subject:From:To:Cc:Date:In-Reply-To:References:From;\n\tb=Mba1vyXhPCK+gMDSAMXnfWHl6HaqzNqWzOFc5NgLSIpDOXKf5tThCE6B3S8TGMUad\n\tjvq5WZ1jyowbIgJ6Ws9G+1+DgxxZ+KnIuMVs6YxgeyvMwUkXchMmzoNVj7ErW5B/xi\n\tZwGyL4qcAy0EooUGiCwvHAdF+xGhhe37kQTnp2wpqNu9P2aGFLk32C2jo96sFWhx+1\n\tXENjW6nV67RmmieBSwLBLlT75t3XAMn6yA0Y4TDhy6+MnkG5/gpbYSGNrrdbTdX3DB\n\tc4LwtwtDRaBqaQvhm3JWRFtrCw8FoSzdvqa2G4p2miOO8XGBO1Y8GRkq8gLyFNfXpm\n\tjGKTqfdOFwiLg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=collabora.com\n\theader.i=@collabora.com\n\theader.b=\"Mba1vyXh\"; dkim-atps=neutral","Message-ID":"<974b4a72f2c438a221cbbc48dc80aeaab338f247.camel@collabora.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 27 Jun 2022 17:13:30 -0400","In-Reply-To":"<20220623232210.18742-9-laurent.pinchart@ideasonboard.com>","References":"<20220623232210.18742-1-laurent.pinchart@ideasonboard.com>\n\t<20220623232210.18742-9-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.44.2 (3.44.2-1.fc36) ","MIME-Version":"1.0","Subject":"Re: [libcamera-devel] [PATCH 08/13] gstreamer: Combine the two pad\n\tloops in the task run handler","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>","From":"Nicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Cc":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]