mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-11 06:11:27 +00:00
v4l2bufferpool: Copy flags and timestamp when importing
Whenever we import from downstream pool (userptr or dmabuf-import), we should copy over the flags and timestamp, otherwise downstream will not get proper synchronization or will not be able to notice frames that has corruption in it. https://bugzilla.gnome.org/show_bug.cgi?id=785680
This commit is contained in:
parent
2c7dfff047
commit
ba8aa440bb
1 changed files with 13 additions and 1 deletions
|
@ -1823,12 +1823,20 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf)
|
||||||
case GST_V4L2_IO_USERPTR:
|
case GST_V4L2_IO_USERPTR:
|
||||||
{
|
{
|
||||||
struct UserPtrData *data;
|
struct UserPtrData *data;
|
||||||
|
GstBuffer *tmp;
|
||||||
|
|
||||||
/* Replace our buffer with downstream allocated buffer */
|
/* Replace our buffer with downstream allocated buffer */
|
||||||
data = gst_mini_object_steal_qdata (GST_MINI_OBJECT (*buf),
|
data = gst_mini_object_steal_qdata (GST_MINI_OBJECT (*buf),
|
||||||
GST_V4L2_IMPORT_QUARK);
|
GST_V4L2_IMPORT_QUARK);
|
||||||
gst_buffer_replace (buf, data->buffer);
|
tmp = gst_buffer_ref (data->buffer);
|
||||||
_unmap_userptr_frame (data);
|
_unmap_userptr_frame (data);
|
||||||
|
|
||||||
|
/* Now tmp is writable, copy the flags and timestamp */
|
||||||
|
gst_buffer_copy_into (tmp, *buf,
|
||||||
|
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
||||||
|
|
||||||
|
gst_buffer_replace (buf, tmp);
|
||||||
|
gst_buffer_unref (tmp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1839,6 +1847,10 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf)
|
||||||
/* Replace our buffer with downstream allocated buffer */
|
/* Replace our buffer with downstream allocated buffer */
|
||||||
tmp = gst_mini_object_steal_qdata (GST_MINI_OBJECT (*buf),
|
tmp = gst_mini_object_steal_qdata (GST_MINI_OBJECT (*buf),
|
||||||
GST_V4L2_IMPORT_QUARK);
|
GST_V4L2_IMPORT_QUARK);
|
||||||
|
|
||||||
|
gst_buffer_copy_into (tmp, *buf,
|
||||||
|
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
||||||
|
|
||||||
gst_buffer_replace (buf, tmp);
|
gst_buffer_replace (buf, tmp);
|
||||||
gst_buffer_unref (tmp);
|
gst_buffer_unref (tmp);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue