GNOME Bugzilla – Bug 590942
avoid recalculating caps in basetransform
Last modified: 2011-11-08 12:36:43 UTC
gst_base_transform_getcaps is called quite often and even with same parameters. It would be nice if we can avoid rerunning all the calculations in those cases. Templatecaps don't change. If we can assume that _transform_caps() only depends on its inputs, we can cache results and avoid recalculation intersects. The attached patch does that. I don't see regressions from unit-tests, nor from totem, rythmbox, buzztard, pitivi and jokosher. Is it safe to do this?
Created attachment 140018 [details] [review] cache previous results and reuse
It's not safe as the caps depend on what gst_base_transform_transform_caps() returns, which can change when, for example, the properties of an element change (capsfilter or videobox or something else). Maybe if the element can notify basetransform that the transform caps would change results, it could clear the cached caps and then it would work. We need to figure out what elements are affected first.
It also depends on the peer caps over which we have absolutely no control here.
Something like this was actually committed recently (168e5c0abb4c33de12c685e0efda6d4f9efdab2f, plus a few later fixes). So marking as resolved duplicate, even though that other bug is newer. *** This bug has been marked as a duplicate of bug 662291 ***