mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 10:40:34 +00:00
videodecoder: Retry setting configuration with modified config
Buffer pool set_config() may return FALSE if requested configuration needed small changes. Reget the config and try setting it again. This ensure we have a configured pool if possible.
This commit is contained in:
parent
0e8b47443e
commit
64d58b80c0
1 changed files with 24 additions and 1 deletions
|
@ -3169,7 +3169,24 @@ gst_video_decoder_decide_allocation_default (GstVideoDecoder * decoder,
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
|
gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
|
||||||
gst_buffer_pool_config_set_allocator (config, allocator, ¶ms);
|
gst_buffer_pool_config_set_allocator (config, allocator, ¶ms);
|
||||||
gst_buffer_pool_set_config (pool, config);
|
|
||||||
|
if (!gst_buffer_pool_set_config (pool, config)) {
|
||||||
|
config = gst_buffer_pool_get_config (pool);
|
||||||
|
|
||||||
|
/* If change are not acceptable, fallback to generic pool */
|
||||||
|
if (!gst_buffer_pool_config_validate_params (config, outcaps, size, min,
|
||||||
|
max)) {
|
||||||
|
GST_DEBUG_OBJECT (decoder, "unsuported pool, making new pool");
|
||||||
|
|
||||||
|
gst_object_unref (pool);
|
||||||
|
pool = gst_video_buffer_pool_new ();
|
||||||
|
gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
|
||||||
|
gst_buffer_pool_config_set_allocator (config, allocator, ¶ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gst_buffer_pool_set_config (pool, config))
|
||||||
|
goto config_failed;
|
||||||
|
}
|
||||||
|
|
||||||
if (update_allocator)
|
if (update_allocator)
|
||||||
gst_query_set_nth_allocation_param (query, 0, allocator, ¶ms);
|
gst_query_set_nth_allocation_param (query, 0, allocator, ¶ms);
|
||||||
|
@ -3187,6 +3204,12 @@ gst_video_decoder_decide_allocation_default (GstVideoDecoder * decoder,
|
||||||
gst_object_unref (pool);
|
gst_object_unref (pool);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
config_failed:
|
||||||
|
GST_ELEMENT_ERROR (decoder, RESOURCE, SETTINGS,
|
||||||
|
("Failed to configure the buffer pool"),
|
||||||
|
("Configuration is most likely invalid, please report this issue."));
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue