diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2018-07-13 16:51:24 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.com> | 2018-07-13 23:16:30 -0400 |
commit | ee9e32db0d1513927ad238f0dd8f8d559bab10d5 (patch) | |
tree | 3b4d3d22fd3461ea33df1c51356e5b21ab418d41 /sys | |
parent | a57c419101ba59f5b78448afce5a67f311b4e909 (diff) | |
download | gstreamer-plugins-good-ee9e32db0d1513927ad238f0dd8f8d559bab10d5.tar.gz |
v4l2bufferpool: Validate that capture buffers were queued
When the pool is started, we allocate and release buffer, expecting
the pool release-buffer handler to queue them. Though, as we rely
on release function, there is no direct way to detect that this
process didn't work.
To check this, validate that the number of queued buffer is the same
as the number of allocated buffers. This allow returning an error
when buffer importation was refused by the driver.
https://bugzilla.gnome.org/show_bug.cgi?id=583890
Diffstat (limited to 'sys')
-rw-r--r-- | sys/v4l2/gstv4l2bufferpool.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index ce4c9aa09..5a92dbb25 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -870,6 +870,9 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool) goto start_failed; if (!V4L2_TYPE_IS_OUTPUT (obj->type)) { + if (g_atomic_int_get (&pool->num_queued) < min_buffers) + goto queue_failed; + pool->group_released_handler = g_signal_connect_swapped (pool->vallocator, "group-released", G_CALLBACK (gst_v4l2_buffer_pool_resurect_buffer), pool); @@ -904,6 +907,11 @@ other_pool_failed: GST_PTR_FORMAT, pool->other_pool); return FALSE; } +queue_failed: + { + GST_ERROR_OBJECT (pool, "failed to queue buffers into the capture queue"); + return FALSE; + } } static gboolean |