Imported dmabuf are not being duped, so they should never be closed. Instead,
we ensure their live time by having strong reference on their original
buffer. This should fix potential flickering due to dmabuf being closed
too early.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5217>
switch (allocator->memory) {
case V4L2_MEMORY_DMABUF:
- close (mem->dmafd);
mem->dmafd = -1;
break;
case V4L2_MEMORY_USERPTR:
obj->munmap (mem->data, group->planes[mem->plane].length);
}
- /* This apply for both mmap with expbuf, and dmabuf imported memory */
- if (mem->dmafd >= 0)
+ if (allocator->memory == V4L2_MEMORY_MMAP && mem->dmafd >= 0)
close (mem->dmafd);
}