summaryrefslogtreecommitdiff
path: root/src/gstreamer/gstlibcameraallocator.cpp
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2021-08-26 20:25:36 +0900
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-08-30 18:08:02 +0300
commite5e7cdf701797463edcbe1f4b26dcc31b32d891d (patch)
tree6e6f75f450c2774b62c93c2084d1338b698e5e7c /src/gstreamer/gstlibcameraallocator.cpp
parent1d2263dd3d7dc68d8d1920682952e17d0a22ed95 (diff)
gstreamer: gstlibcameraallocator: Use offset in creating a buffer
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@chromium.org> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/gstreamer/gstlibcameraallocator.cpp')
-rw-r--r--src/gstreamer/gstlibcameraallocator.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gstreamer/gstlibcameraallocator.cpp b/src/gstreamer/gstlibcameraallocator.cpp
index a8fa4f86..cb07d6e9 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);