[libcamera-devel] [PATCH v3 6/9] gstreamer: gstlibcameraallocator: Use offset in creating a buffer
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Thu Aug 26 14:51:04 CEST 2021
Hi Hiro,
Thank you for the patch.
On Thu, Aug 26, 2021 at 08:25:36PM +0900, Hirokazu Honda wrote:
> The plane length is the length of the plane size. The buffer length
> to be allocated for a plane is the offset and the length of
> FrameBuffer::Plane.
>
> Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> src/gstreamer/gstlibcameraallocator.cpp | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/gstreamer/gstlibcameraallocator.cpp b/src/gstreamer/gstlibcameraallocator.cpp
> index 7bd8ba2d..60ead273 100644
> --- a/src/gstreamer/gstlibcameraallocator.cpp
> +++ b/src/gstreamer/gstlibcameraallocator.cpp
> @@ -52,8 +52,10 @@ FrameWrap::FrameWrap(GstAllocator *allocator, FrameBuffer *buffer,
> outstandingPlanes_(0)
> {
> for (const FrameBuffer::Plane &plane : buffer->planes()) {
> - GstMemory *mem = gst_fd_allocator_alloc(allocator, plane.fd.fd(), plane.length,
> + GstMemory *mem = gst_fd_allocator_alloc(allocator, plane.fd.fd(),
> + plane.offset + plane.length,
> GST_FD_MEMORY_FLAG_DONT_CLOSE);
> + gst_memory_resize(mem, plane.offset, plane.length);
> gst_mini_object_set_qdata(GST_MINI_OBJECT(mem), getQuark(), this, nullptr);
> GST_MINI_OBJECT(mem)->dispose = gst_libcamera_allocator_release;
> g_object_unref(mem->allocator);
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list