Commit a57c4191 authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2bufferpool: Only return eos for M2M devices

This will avoid sending EOS on v4l2src when a driver sends an empty
buffers. This case would be a bug in the driver, but yet the camera
should keep running.

This also removes the check for corrupted buffers, as this check is
already done later.

https://bugzilla.gnome.org/show_bug.cgi?id=794842
parent 411fdff3
......@@ -1712,12 +1712,9 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf)
guint num_queued;
gsize size = gst_buffer_get_size (*buf);
if (size == 0) {
if (GST_BUFFER_FLAG_IS_SET (*buf, GST_BUFFER_FLAG_CORRUPTED))
goto buffer_corrupted;
else
goto eos;
}
/* Legacy M2M devices return empty buffer when drained */
if (size == 0 && GST_V4L2_IS_M2M (obj->device_caps))
goto eos;
if (GST_VIDEO_INFO_FORMAT (&pool->caps_info) !=
GST_VIDEO_FORMAT_ENCODED && size < pool->size)
......@@ -1767,14 +1764,10 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf)
/* An empty buffer on capture indicates the end of stream */
if (gst_buffer_get_size (tmp) == 0) {
gboolean corrupted = GST_BUFFER_FLAG_IS_SET (tmp,
GST_BUFFER_FLAG_CORRUPTED);
gst_v4l2_buffer_pool_release_buffer (bpool, tmp);
if (corrupted)
goto buffer_corrupted;
else
/* Legacy M2M devices return empty buffer when drained */
if (GST_V4L2_IS_M2M (obj->device_caps))
goto eos;
}
......@@ -1945,13 +1938,6 @@ copy_failed:
GST_ERROR_OBJECT (pool, "failed to copy buffer");
return ret;
}
buffer_corrupted:
{
GST_WARNING_OBJECT (pool, "Dropping corrupted buffer without payload");
gst_buffer_unref (*buf);
*buf = NULL;
return GST_V4L2_FLOW_CORRUPTED_BUFFER;
}
buffer_truncated:
{
GST_WARNING_OBJECT (pool,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment