summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Waters <ystreet00@gmail.com>2013-03-14 11:15:29 +1100
committerTim-Philipp Müller <tim@centricular.net>2013-04-01 21:13:38 +0100
commit4f1ba51c4bf1b04867976ad081057c2d06ae36bb (patch)
tree4528beafa4072b6d44585d48c54fe764d763d214
parent229d7aa910c9034aeb54994cc3aadea7614526b1 (diff)
visualizer: 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
-rw-r--r--ext/libvisual/gstaudiovisualizer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/libvisual/gstaudiovisualizer.c b/ext/libvisual/gstaudiovisualizer.c
index 29c45d702..aead4f1bb 100644
--- a/ext/libvisual/gstaudiovisualizer.c
+++ b/ext/libvisual/gstaudiovisualizer.c
@@ -932,6 +932,7 @@ default_decide_allocation (GstAudioVisualizer * scope, GstQuery * query)
GstAllocationParams params;
GstStructure *config;
gboolean update_allocator;
+ gboolean update_pool;
gst_query_parse_allocation (query, &outcaps, NULL);
@@ -949,10 +950,12 @@ default_decide_allocation (GstAudioVisualizer * scope, GstQuery * query)
if (gst_query_get_n_allocation_pools (query) > 0) {
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
+ update_pool = TRUE;
} else {
pool = NULL;
size = GST_VIDEO_INFO_SIZE (&scope->vinfo);
min = max = 0;
+ update_pool = FALSE;
}
if (pool == NULL) {
@@ -974,10 +977,13 @@ default_decide_allocation (GstAudioVisualizer * scope, GstQuery * query)
if (allocator)
gst_object_unref (allocator);
- if (pool) {
+ if (update_pool)
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);
- }
return TRUE;
}