From: Sebastian Dröge Date: Fri, 16 Jan 2015 18:17:31 +0000 (+0100) Subject: bin: Pass structs we plan to modify around by pointer, not value X-Git-Tag: 1.6.1~595 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b2c79eda703b694632d0f4e19e59daafb18e311;p=platform%2Fupstream%2Fgstreamer.git 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. --- diff --git a/gst/gstbin.c b/gst/gstbin.c index 2d95070..28b0436 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)