mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
v4l2: bufferpool: Fix buffer resize asserstion
When we fill a bitstream buffer the buffer might be too small to hold the entire frame. Only resize to the filled size, preventing the following assertion to happen. gst_buffer_resize_range: assertion 'bufmax >= bufoffs + offset + size' failed Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5100>
This commit is contained in:
parent
d381a28beb
commit
de5e1e334e
1 changed files with 4 additions and 2 deletions
|
@ -164,16 +164,18 @@ gst_v4l2_buffer_pool_copy_buffer (GstV4l2BufferPool * pool, GstBuffer * dest,
|
|||
gst_video_frame_unmap (&dest_frame);
|
||||
} else {
|
||||
GstMapInfo map;
|
||||
gsize filled_size;
|
||||
|
||||
GST_DEBUG_OBJECT (pool, "copy raw bytes");
|
||||
|
||||
if (!gst_buffer_map (src, &map, GST_MAP_READ))
|
||||
goto invalid_buffer;
|
||||
|
||||
filled_size =
|
||||
gst_buffer_fill (dest, 0, map.data, gst_buffer_get_size (src));
|
||||
|
||||
gst_buffer_unmap (src, &map);
|
||||
gst_buffer_resize (dest, 0, gst_buffer_get_size (src));
|
||||
gst_buffer_resize (dest, 0, filled_size);
|
||||
}
|
||||
|
||||
gst_buffer_copy_into (dest, src,
|
||||
|
|
Loading…
Reference in a new issue