mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
v4l2src: check for valid size on raw video buffers
Discard buffers that doesn't contain enough data when dealing with raw video inputs. https://bugzilla.gnome.org/show_bug.cgi?id=767086
This commit is contained in:
parent
4498e57c10
commit
b7866315a6
1 changed files with 10 additions and 1 deletions
|
@ -1725,14 +1725,23 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf)
|
|||
|
||||
if ((*buf)->pool == bpool) {
|
||||
guint num_queued;
|
||||
gsize size = gst_buffer_get_size (*buf);
|
||||
|
||||
if (gst_buffer_get_size (*buf) == 0) {
|
||||
if (size == 0) {
|
||||
if (GST_BUFFER_FLAG_IS_SET (*buf, GST_BUFFER_FLAG_CORRUPTED))
|
||||
goto buffer_corrupted;
|
||||
else
|
||||
goto eos;
|
||||
}
|
||||
|
||||
/* verify that buffer contains a full frame for raw video */
|
||||
if (GST_VIDEO_INFO_FORMAT (&obj->info) != GST_VIDEO_FORMAT_ENCODED
|
||||
&& size < GST_VIDEO_INFO_SIZE (&obj->info)) {
|
||||
GST_WARNING_OBJECT (pool, "Invalid buffer size, this is likely "
|
||||
"due to a bug in your driver, dropping");
|
||||
goto buffer_corrupted;
|
||||
}
|
||||
|
||||
num_queued = g_atomic_int_get (&pool->num_queued);
|
||||
GST_TRACE_OBJECT (pool, "Only %i buffer left in the capture queue.",
|
||||
num_queued);
|
||||
|
|
Loading…
Reference in a new issue