diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2019-03-07 11:24:38 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2019-05-06 23:43:07 +0200 |
commit | 93d247fb2a3ed25141e048af2064b298f62c92d3 (patch) | |
tree | e7ea27d8b088947e8f0a5c2263c6770d96506af3 | |
parent | 3bc7fc1fe457e6a97dcda3f58c07c44f87c69da3 (diff) | |
download | gstreamer-plugins-good-93d247fb2a3ed25141e048af2064b298f62c92d3.tar.gz |
v4l2sink: fix pool-less allocation query handling
This fixes a critical warning if the last-sample property is enabled:
(gst-launch-1.0:391): GStreamer-CRITICAL **: 01:12:57.428: gst_object_unref: assertion 'object != NULL' failed
If the allocation query does not contain any allocation pools,
gst_query_parse_nth_allocation_pool will leave the local pool,
min, and max variables undefined, so check the array length first.
If pool is NULL, do not call gst_object_unref.
-rw-r--r-- | sys/v4l2/gstv4l2sink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/v4l2/gstv4l2sink.c b/sys/v4l2/gstv4l2sink.c index 87392187e..48ed8f4b0 100644 --- a/sys/v4l2/gstv4l2sink.c +++ b/sys/v4l2/gstv4l2sink.c @@ -556,7 +556,7 @@ gst_v4l2sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) g_object_get (bsink, "enable-last-sample", &last_sample_enabled, NULL); - if (last_sample_enabled) { + if (last_sample_enabled && gst_query_get_n_allocation_pools (query) > 0) { GstBufferPool *pool; guint size, min, max; @@ -568,7 +568,8 @@ gst_v4l2sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) max = min; gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max); - gst_object_unref (pool); + if (pool) + gst_object_unref (pool); } return TRUE; |