audiovisualizer: handle non-existant pool in the default allocation query
gst_query_set_nth_allocation_pool() requires there to be a pool in the query already. This is not always the case when we get the query from upstream. Use gst_query_add_allocation_pool() instead in such case. https://bugzilla.gnome.org/show_bug.cgi?id=681719
This commit is contained in:
parent
5d72759fec
commit
bf502f5502
@ -936,6 +936,7 @@ default_decide_allocation (GstAudioVisualizer * scope, GstQuery * query)
|
|||||||
GstAllocationParams params;
|
GstAllocationParams params;
|
||||||
GstStructure *config;
|
GstStructure *config;
|
||||||
gboolean update_allocator;
|
gboolean update_allocator;
|
||||||
|
gboolean update_pool;
|
||||||
|
|
||||||
gst_query_parse_allocation (query, &outcaps, NULL);
|
gst_query_parse_allocation (query, &outcaps, NULL);
|
||||||
|
|
||||||
@ -953,10 +954,12 @@ default_decide_allocation (GstAudioVisualizer * scope, GstQuery * query)
|
|||||||
|
|
||||||
if (gst_query_get_n_allocation_pools (query) > 0) {
|
if (gst_query_get_n_allocation_pools (query) > 0) {
|
||||||
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
|
||||||
|
update_pool = TRUE;
|
||||||
} else {
|
} else {
|
||||||
pool = NULL;
|
pool = NULL;
|
||||||
size = GST_VIDEO_INFO_SIZE (&scope->vinfo);
|
size = GST_VIDEO_INFO_SIZE (&scope->vinfo);
|
||||||
min = max = 0;
|
min = max = 0;
|
||||||
|
update_pool = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pool == NULL) {
|
if (pool == NULL) {
|
||||||
@ -978,10 +981,13 @@ default_decide_allocation (GstAudioVisualizer * scope, GstQuery * query)
|
|||||||
if (allocator)
|
if (allocator)
|
||||||
gst_object_unref (allocator);
|
gst_object_unref (allocator);
|
||||||
|
|
||||||
if (pool) {
|
if (update_pool)
|
||||||
gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
|
gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
|
||||||
|
else
|
||||||
|
gst_query_add_allocation_pool (query, pool, size, min, max);
|
||||||
|
|
||||||
|
if (pool)
|
||||||
gst_object_unref (pool);
|
gst_object_unref (pool);
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user