mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
pool-nego: 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 (validating the changes first). This ensure we have a configured pool if possible. https://bugzilla.gnome.org/show_bug.cgi?id=727916
This commit is contained in:
parent
194db480e0
commit
23e69d98d8
2 changed files with 46 additions and 2 deletions
|
@ -3055,7 +3055,23 @@ gst_base_src_decide_allocation_default (GstBaseSrc * basesrc, GstQuery * query)
|
|||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
|
||||
gst_buffer_pool_config_set_allocator (config, allocator, ¶ms);
|
||||
gst_buffer_pool_set_config (pool, config);
|
||||
|
||||
/* buffer pool may have to do some changes */
|
||||
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 (basesrc, "unsuported pool, making new pool");
|
||||
|
||||
gst_object_unref (pool);
|
||||
pool = gst_buffer_pool_new ();
|
||||
}
|
||||
|
||||
if (!gst_buffer_pool_set_config (pool, config))
|
||||
goto config_failed;
|
||||
}
|
||||
}
|
||||
|
||||
if (update_allocator)
|
||||
|
@ -3071,6 +3087,12 @@ gst_base_src_decide_allocation_default (GstBaseSrc * basesrc, GstQuery * query)
|
|||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
config_failed:
|
||||
GST_ELEMENT_ERROR (basesrc, RESOURCE, SETTINGS,
|
||||
("Failed to configure the buffer pool"),
|
||||
("Configuration is most likely invalid, please report this issue."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -899,7 +899,23 @@ gst_base_transform_default_decide_allocation (GstBaseTransform * trans,
|
|||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set_params (config, outcaps, size, min, max);
|
||||
gst_buffer_pool_config_set_allocator (config, allocator, ¶ms);
|
||||
gst_buffer_pool_set_config (pool, config);
|
||||
|
||||
/* buffer pool may have to do some changes */
|
||||
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 (trans, "unsuported pool, making new pool");
|
||||
|
||||
gst_object_unref (pool);
|
||||
pool = gst_buffer_pool_new ();
|
||||
}
|
||||
|
||||
if (!gst_buffer_pool_set_config (pool, config))
|
||||
goto config_failed;
|
||||
}
|
||||
}
|
||||
|
||||
if (update_allocator)
|
||||
|
@ -915,6 +931,12 @@ gst_base_transform_default_decide_allocation (GstBaseTransform * trans,
|
|||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
config_failed:
|
||||
GST_ELEMENT_ERROR (trans, RESOURCE, SETTINGS,
|
||||
("Failed to configure the buffer pool"),
|
||||
("Configuration is most likely invalid, please report this issue."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue