summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2014-05-05 12:38:33 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2014-05-08 15:56:37 -0400
commitdfdd1ba9d9ff94de887efe8309b64847dc562a38 (patch)
treeb52e3fff7f691839d38614060d1883e47b0436c2 /sys
parent1304c74c6a2c29f91e1fea8521e1f42c9601e577 (diff)
v4l2allocator: Reset imported buffer size with expected size
This ensure that the buffer pool won't always discard buffer with these memory when they are released.
Diffstat (limited to 'sys')
-rw-r--r--sys/v4l2/gstv4l2allocator.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/v4l2/gstv4l2allocator.c b/sys/v4l2/gstv4l2allocator.c
index 3e56570ff..ebc1f3154 100644
--- a/sys/v4l2/gstv4l2allocator.c
+++ b/sys/v4l2/gstv4l2allocator.c
@@ -560,17 +560,33 @@ gst_v4l2_allocator_reset_size (GstV4l2Allocator * allocator,
GstV4l2MemoryGroup * group)
{
gsize size;
+ gboolean imported = FALSE;
+
+ switch (allocator->memory) {
+ case V4L2_MEMORY_USERPTR:
+ case V4L2_MEMORY_DMABUF:
+ imported = TRUE;
+ break;
+ }
if (V4L2_TYPE_IS_MULTIPLANAR (allocator->type)) {
gint i;
for (i = 0; i < group->n_mem; i++) {
size = allocator->format.fmt.pix_mp.plane_fmt[i].sizeimage;
+
+ if (imported)
+ group->mem[i]->maxsize = size;
+
gst_memory_resize (group->mem[i], 0, size);
}
} else {
size = allocator->format.fmt.pix.sizeimage;
+
+ if (imported)
+ group->mem[0]->maxsize = size;
+
gst_memory_resize (group->mem[0], 0, size);
}
}
@@ -1356,12 +1372,13 @@ gst_v4l2_allocator_reset_group (GstV4l2Allocator * allocator,
gst_v4l2_allocator_clear_dmabufin (allocator, group);
break;
case V4L2_MEMORY_MMAP:
- gst_v4l2_allocator_reset_size (allocator, group);
break;
default:
g_assert_not_reached ();
break;
}
+
+ gst_v4l2_allocator_reset_size (allocator, group);
}
gsize