mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-23 15:48:23 +00:00
v4l2bufferpool: Drop truncated frames
Drop truncated frames regardless if they have the ERROR flag or not. Truncated frame causes video frame map failure in many elements including cluttersink, glupload etc.
This commit is contained in:
parent
e943a11bab
commit
90eade28f2
1 changed files with 12 additions and 0 deletions
|
@ -1747,6 +1747,10 @@ gst_v4l2_buffer_pool_process (GstV4l2BufferPool * pool, GstBuffer ** buf)
|
||||||
goto eos;
|
goto eos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GST_VIDEO_INFO_FORMAT (&pool->caps_info) !=
|
||||||
|
GST_VIDEO_FORMAT_ENCODED && size < pool->size)
|
||||||
|
goto buffer_truncated;
|
||||||
|
|
||||||
num_queued = g_atomic_int_get (&pool->num_queued);
|
num_queued = g_atomic_int_get (&pool->num_queued);
|
||||||
GST_TRACE_OBJECT (pool, "Only %i buffer left in the capture queue.",
|
GST_TRACE_OBJECT (pool, "Only %i buffer left in the capture queue.",
|
||||||
num_queued);
|
num_queued);
|
||||||
|
@ -1984,6 +1988,14 @@ buffer_corrupted:
|
||||||
*buf = NULL;
|
*buf = NULL;
|
||||||
return GST_V4L2_FLOW_CORRUPTED_BUFFER;
|
return GST_V4L2_FLOW_CORRUPTED_BUFFER;
|
||||||
}
|
}
|
||||||
|
buffer_truncated:
|
||||||
|
{
|
||||||
|
GST_WARNING_OBJECT (pool,
|
||||||
|
"Dropping truncated buffer, this is likely a driver bug.");
|
||||||
|
gst_buffer_unref (*buf);
|
||||||
|
*buf = NULL;
|
||||||
|
return GST_V4L2_FLOW_CORRUPTED_BUFFER;
|
||||||
|
}
|
||||||
eos:
|
eos:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (pool, "end of stream reached");
|
GST_DEBUG_OBJECT (pool, "end of stream reached");
|
||||||
|
|
Loading…
Reference in a new issue