mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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.
This commit is contained in:
parent
1304c74c6a
commit
dfdd1ba9d9
1 changed files with 18 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue