[{"id":23672,"web_url":"https://patchwork.libcamera.org/comment/23672/","msgid":"<1199325e-ec0c-07e2-f468-fd5cba262e59@ideasonboard.com>","date":"2022-06-30T08:28:32","subject":"Re: [libcamera-devel] [PATCH v2 07/12] gstreamer: Combine the two\n\tpad loops in the task run handler","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Laurent,\n\nThank you for the patch.\n\nOn 6/30/22 05:32, Laurent Pinchart via libcamera-devel wrote:\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> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.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 2cb915637874..8c1cd7017d98 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 3C75CBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Jun 2022 08:28:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A545F6054C;\n\tThu, 30 Jun 2022 10:28:40 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 891636054C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jun 2022 10:28:38 +0200 (CEST)","from [IPV6:2401:4900:1f3f:ca21:e286:106b:5da4:9482] (unknown\n\t[IPv6:2401:4900:1f3f:ca21:e286:106b:5da4:9482])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C0B3B45F;\n\tThu, 30 Jun 2022 10:28:36 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656577720;\n\tbh=CMNvSFqbQ5CXb+NPoA7+cNTLQXH6olzGYG+UieGe5ZU=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=GHJsRyNOsBDSD6j0e/CpRWwm5lDNSwsk919bnxdUyPoLds9SlmzvVJCznkgtNe3sc\n\ta/hYpXmQkZLQcmes3LjSgsz2wCU31zerABhxnjbIgkpzWrAeigS7lWETaH8J7STVdm\n\tbLZW8qrYkENiaQE3kzqMoJvUPBbEVSqMIypJ2L0lMbYli67Svbk7CAZSFf/ZBsWnuj\n\tGx4CrwJfoJMO7fdJSae/46eLimyp+LI8jGTKbWbUGQa1mvw0FIwdVG+ZkedINIZNEK\n\trzEl852I9FmDTTczzsvxiaXHqHZwUwdpuDbVPZ7dR7YIl506zmlmq8qvTAhdAv1MWg\n\tiXLl3jKzXz76Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1656577718;\n\tbh=CMNvSFqbQ5CXb+NPoA7+cNTLQXH6olzGYG+UieGe5ZU=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=kS1OoPNynqPnTKnm/GThs03IRkwn+VH1ccEBkTbDH7nHtRpNGiXu7mcF5eDoiOysM\n\tlrbASwRejf6rozct2a/wClYS+tfN5w4m94EJyXtllFGBGZy08OYPFP/dxp7VJp7lmg\n\tDnVHyE0ZrwxA/W5qypMa+3P64t7cLRCUsGFC60MQ="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"kS1OoPNy\"; dkim-atps=neutral","Message-ID":"<1199325e-ec0c-07e2-f468-fd5cba262e59@ideasonboard.com>","Date":"Thu, 30 Jun 2022 13:58:32 +0530","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.4.1","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220630000251.31295-1-laurent.pinchart@ideasonboard.com>\n\t<20220630000251.31295-8-laurent.pinchart@ideasonboard.com>","In-Reply-To":"<20220630000251.31295-8-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v2 07/12] gstreamer: Combine the two\n\tpad loops 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":"Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]