From 97b768675a72042607588921f429652af9249eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 29 Apr 2015 12:27:43 +0200 Subject: [PATCH] plugins: check gst_buffer_pool_set_config() Check the return value of gst_buffer_pool_set_config(). If it fails an error message is posted in the bus. --- gst/vaapi/gstvaapipluginbase.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/gst/vaapi/gstvaapipluginbase.c b/gst/vaapi/gstvaapipluginbase.c index a5f3d29d16..206848d541 100644 --- a/gst/vaapi/gstvaapipluginbase.c +++ b/gst/vaapi/gstvaapipluginbase.c @@ -700,7 +700,8 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, gst_buffer_pool_config_set_params (config, caps, size, min, max); gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VAAPI_VIDEO_META); - gst_buffer_pool_set_config (pool, config); + if (!gst_buffer_pool_set_config (pool, config)) + goto config_failed; } /* Check whether GstVideoMeta, or GstVideoAlignment, is needed (raw video) */ @@ -708,12 +709,14 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, config = gst_buffer_pool_get_config (pool); gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META); - gst_buffer_pool_set_config (pool, config); + if (!gst_buffer_pool_set_config (pool, config)) + goto config_failed; } else if (has_video_alignment) { config = gst_buffer_pool_get_config (pool); gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); - gst_buffer_pool_set_config (pool, config); + if (!gst_buffer_pool_set_config (pool, config)) + goto config_failed; } /* GstVideoGLTextureUploadMeta (OpenGL) */ @@ -722,7 +725,8 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, config = gst_buffer_pool_get_config (pool); gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META); - gst_buffer_pool_set_config (pool, config); + if (!gst_buffer_pool_set_config (pool, config)) + goto config_failed; } #endif @@ -752,6 +756,15 @@ error_create_pool: GST_ERROR_OBJECT (plugin, "failed to create buffer pool"); return FALSE; } +config_failed: + { + if (pool) + gst_object_unref (pool); + GST_ELEMENT_ERROR (plugin, RESOURCE, SETTINGS, + ("Failed to configure the buffer pool"), + ("Configuration is most likely invalid, please report this issue.")); + return FALSE; + } } /**