From ef633e28f8f0465b7a5ad4a859b3176d2f7a9e96 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 21 Jul 2017 15:40:24 -0400 Subject: [PATCH] v4l2encoder: Fix negotiation error handling The subclass negotiated function will call set_format, if that fails the pool will not be created. We ended up with an assertion. GStreamer-CRITICAL **: gst_buffer_pool_set_active: assertion 'GST_IS_BUFFER_POOL (pool)' failed --- sys/v4l2/gstv4l2videoenc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/v4l2/gstv4l2videoenc.c b/sys/v4l2/gstv4l2videoenc.c index 12f1eb4666..644141f2dd 100644 --- a/sys/v4l2/gstv4l2videoenc.c +++ b/sys/v4l2/gstv4l2videoenc.c @@ -377,17 +377,17 @@ static gboolean gst_v4l2_video_enc_negotiate (GstVideoEncoder * encoder) { GstV4l2VideoEnc *self = GST_V4L2_VIDEO_ENC (encoder); - gboolean ret; - ret = GST_VIDEO_ENCODER_CLASS (parent_class)->negotiate (encoder); + if (!GST_VIDEO_ENCODER_CLASS (parent_class)->negotiate (encoder)) + return FALSE; if (!gst_buffer_pool_set_active (GST_BUFFER_POOL (self->v4l2capture->pool), TRUE)) { GST_WARNING_OBJECT (self, "Could not activate capture buffer pool."); - ret = FALSE; + return FALSE; } - return ret; + return TRUE; } static GstVideoCodecFrame *