[{"id":3687,"web_url":"https://patchwork.libcamera.org/comment/3687/","msgid":"<20200212003016.GU20823@pendragon.ideasonboard.com>","date":"2020-02-12T00:30:16","subject":"Re: [libcamera-devel] [PATCH v1 21/23] gst: pad: Add method to\n\tstore retrieve pending buffers","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Nicolas,\n\nThank you for the patch.\n\nOn Tue, Jan 28, 2020 at 10:32:08PM -0500, Nicolas Dufresne wrote:\n> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> \n> These will be useful for streaming. The requestComplete callback will\n> store the buffers on each pads so that the _run() can pick them up\n> and push them through the pads from a streaming thread.\n> \n> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> ---\n>  src/gstreamer/gstlibcamerapad.cpp | 28 ++++++++++++++++++++++++++++\n>  src/gstreamer/gstlibcamerapad.h   |  4 ++++\n>  2 files changed, 32 insertions(+)\n> \n> diff --git a/src/gstreamer/gstlibcamerapad.cpp b/src/gstreamer/gstlibcamerapad.cpp\n> index 6401810..4a775e4 100644\n> --- a/src/gstreamer/gstlibcamerapad.cpp\n> +++ b/src/gstreamer/gstlibcamerapad.cpp\n> @@ -17,6 +17,7 @@ struct _GstLibcameraPad {\n>  \tGstPad parent;\n>  \tStreamRole role;\n>  \tGstLibcameraPool *pool;\n> +\tGQueue pending_buffers;\n>  };\n>  \n>  enum {\n> @@ -136,3 +137,30 @@ gst_libcamera_pad_get_stream(GstPad *pad)\n>  \n>  \treturn nullptr;\n>  }\n> +\n> +void\n> +gst_libcamera_pad_queue_buffer(GstPad *pad, GstBuffer *buffer)\n> +{\n> +\tGST_OBJECT_LOCKER(pad);\n> +\tauto *self = GST_LIBCAMERA_PAD(pad);\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> +\tGstFlowReturn ret = GST_FLOW_CUSTOM_SUCCESS;\n> +\n> +\t{\n> +\t\tGST_OBJECT_LOCKER(self);\n> +\t\tbuffer = (GstBuffer *)g_queue_pop_tail(&self->pending_buffers);\n> +\t}\n> +\n> +\tif (buffer)\n> +\t\tret = gst_pad_push(pad, buffer);\n> +\n> +\treturn ret;\n\nYou could write this\n\n\tif (!buffer)\n\t\treturn GST_FLOW_CUSTOM_SUCCESS;\n\n\treturn gst_pad_push(pad, buffer);\n\nand drop the ret variable.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +}\n> diff --git a/src/gstreamer/gstlibcamerapad.h b/src/gstreamer/gstlibcamerapad.h\n> index 81d0d58..d928570 100644\n> --- a/src/gstreamer/gstlibcamerapad.h\n> +++ b/src/gstreamer/gstlibcamerapad.h\n> @@ -26,4 +26,8 @@ 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>  #endif /* __GST_LIBCAMERA_PAD_H__ */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E54C761020\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Feb 2020 01:30:31 +0100 (CET)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 654D79DA;\n\tWed, 12 Feb 2020 01:30:31 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1581467431;\n\tbh=O6lXXoqMyki1O26tewyGo+u3sigUvvxaMGkdCHIUVqM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=vamYA4sBkrSYNRoSz0PPYCnJQnqIS10QihwxSMCBowxpg+N/4Gp7ycVkn1rfLRF+t\n\t4S83Ndd5nQmD/huJ8z7i3GFCShcrfMLl18RIf0aCXZ5MfugKAKG/AHPDRbG8aqC1Qe\n\tBPHFquKzXR0QsCq5otiibmXTQlLiS3qchLUX/3UE=","Date":"Wed, 12 Feb 2020 02:30:16 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Nicolas Dufresne <nicolas@ndufresne.ca>","Cc":"libcamera-devel@lists.libcamera.org,\n\tNicolas Dufresne <nicolas.dufresne@collabora.com>","Message-ID":"<20200212003016.GU20823@pendragon.ideasonboard.com>","References":"<20200129033210.278800-1-nicolas@ndufresne.ca>\n\t<20200129033210.278800-22-nicolas@ndufresne.ca>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200129033210.278800-22-nicolas@ndufresne.ca>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v1 21/23] gst: pad: Add method to\n\tstore retrieve pending buffers","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>","X-List-Received-Date":"Wed, 12 Feb 2020 00:30:32 -0000"}}]