summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-01-16 19:17:31 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-01-16 19:17:31 +0100
commit5b2c79eda703b694632d0f4e19e59daafb18e311 (patch)
treeba33461eadbde5d7e63237e10a06460ef5b8021d
parent0bd45dc4014d9fd89c3535dc692efab20e9c5644 (diff)
bin: Pass structs we plan to modify around by pointer, not value
Otherwise the struct is going to be copied, which is not very efficient. And also has the nice side effect that modifications of the struct might be done in a copy, and we later use the original struct without the changes. Caused LATENCY queries to always return the initialization values in one of my tests, instead of the actual values reported by child elements.
-rw-r--r--gst/gstbin.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gst/gstbin.c b/gst/gstbin.c
index 2d95070b4..28b043697 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -3936,7 +3936,7 @@ bin_query_generic_fold (const GValue * vitem, GValue * ret, QueryFold * fold)
static gboolean
bin_iterate_fold (GstBin * bin, GstIterator * iter, QueryInitFunction fold_init,
QueryDoneFunction fold_done, GstIteratorFoldFunction fold_func,
- QueryFold fold_data, gboolean default_return)
+ QueryFold * fold_data, gboolean default_return)
{
gboolean res = default_return;
GValue ret = { 0 };
@@ -3947,20 +3947,20 @@ bin_iterate_fold (GstBin * bin, GstIterator * iter, QueryInitFunction fold_init,
while (TRUE) {
GstIteratorResult ires;
- ires = gst_iterator_fold (iter, fold_func, &ret, &fold_data);
+ ires = gst_iterator_fold (iter, fold_func, &ret, fold_data);
switch (ires) {
case GST_ITERATOR_RESYNC:
gst_iterator_resync (iter);
if (fold_init)
- fold_init (bin, &fold_data);
+ fold_init (bin, fold_data);
g_value_set_boolean (&ret, res);
break;
case GST_ITERATOR_OK:
case GST_ITERATOR_DONE:
res = g_value_get_boolean (&ret);
if (fold_done != NULL && res)
- fold_done (bin, &fold_data);
+ fold_done (bin, fold_data);
goto done;
default:
res = FALSE;
@@ -4058,7 +4058,7 @@ gst_bin_query (GstElement * element, GstQuery * query)
fold_init (bin, &fold_data);
res =
- bin_iterate_fold (bin, iter, fold_init, fold_done, fold_func, fold_data,
+ bin_iterate_fold (bin, iter, fold_init, fold_done, fold_func, &fold_data,
default_return);
gst_iterator_free (iter);
@@ -4067,7 +4067,7 @@ gst_bin_query (GstElement * element, GstQuery * query)
iter = gst_element_iterate_src_pads (element);
src_pads_query_result =
bin_iterate_fold (bin, iter, fold_init, fold_done, fold_func,
- fold_data, default_return);
+ &fold_data, default_return);
gst_iterator_free (iter);
if (src_pads_query_result)