if (ctx.num_pads > 1)
ctx.min_buffers++;
- gst_query_add_allocation_param (ctx.query, NULL, &ctx.params);
- gst_query_add_allocation_pool (ctx.query, NULL, ctx.size,
- ctx.min_buffers, 0);
+ /* Check that we actually have parameters besides the defaults. */
+ if (ctx.params.align || ctx.params.prefix || ctx.params.padding) {
+ gst_query_add_allocation_param (ctx.query, NULL, &ctx.params);
+ }
+ /* When size == 0, buffers created from this pool would have no memory
+ * allocated. */
+ if (ctx.size) {
+ gst_query_add_allocation_pool (ctx.query, NULL, ctx.size,
+ ctx.min_buffers, 0);
+ }
} else {
gst_tee_clear_query_allocation_meta (query);
}
GST_END_TEST;
static gboolean
+allocation_query0 (GstPad * pad, GstObject * parent, GstQuery * query)
+{
+ GstAllocationParams param = { 0, 0, 0, 0 };
+
+ if (GST_QUERY_TYPE (query) != GST_QUERY_ALLOCATION)
+ return gst_pad_query_default (pad, parent, query);
+
+ gst_query_add_allocation_pool (query, NULL, 0, 0, 0);
+ gst_query_add_allocation_param (query, NULL, ¶m);
+
+ return TRUE;
+}
+
+static gboolean
allocation_query1 (GstPad * pad, GstObject * parent, GstQuery * query)
{
GstAllocationParams param = { 0, 15, 1, 1 };
GST_END_TEST;
+
+GST_START_TEST (test_allocation_query_no_pool)
+{
+ GstElement *tee;
+ GstPad *sinkpad;
+ GstCaps *caps;
+ GstQuery *query;
+
+ tee = gst_check_setup_element ("tee");
+ fail_unless (tee);
+
+ sinkpad = gst_element_get_static_pad (tee, "sink");
+ add_sink_pad_and_setup_query_func (tee, allocation_query0);
+
+ caps = gst_caps_new_empty_simple ("test/test");
+
+ query = gst_query_new_allocation (caps, TRUE);
+ fail_unless (gst_pad_query (sinkpad, query));
+
+ ck_assert_int_eq (gst_query_get_n_allocation_pools (query), 0);
+
+ gst_caps_unref (caps);
+ gst_query_unref (query);
+ gst_check_teardown_pad_by_name (tee, "src_0");
+ gst_object_unref (sinkpad);
+ gst_check_teardown_element (tee);
+}
+
+GST_END_TEST;
+
+
static Suite *
tee_suite (void)
{
tcase_add_test (tc_chain, test_allocation_query_aggregation);
tcase_add_test (tc_chain, test_allocation_query_allow_not_linked);
tcase_add_test (tc_chain, test_allocation_query_failure);
+ tcase_add_test (tc_chain, test_allocation_query_no_pool);
return s;
}