GNOME Bugzilla – Bug 667300
basesrc: fixes potential caps-memoryleak
Last modified: 2012-05-18 06:40:49 UTC
Created attachment 204618 [details] [review] patch .
It seems to me that there was no leak here. Am I missing something ? This patch just repeats the peercaps test which was done before already.
Comment on attachment 204618 [details] [review] patch I don't see the potential leak here either, and as far as I can tell the new version is functionally 100% equivalent to the old version.
What if peercaps == GST_CAPS_ANY ? if (peercaps && !gst_caps_is_any (peercaps)) { /* get intersection */ caps = gst_caps_intersect_full (peercaps, thiscaps, GST_CAPS_INTERSECT_FIRST); GST_DEBUG_OBJECT (basesrc, "intersect: %" GST_PTR_FORMAT, caps); gst_caps_unref (peercaps); } else { /* no peer, work with our own caps then */ caps = gst_caps_copy (thiscaps); } } It would go into the "else", and there peercaps would not be freed?
Ah, yes. But the code upstream (both git and 0.10.35) is: 2663 /* get the peer caps */ 2664 peercaps = gst_pad_peer_get_caps_reffed (GST_BASE_SRC_PAD (basesrc)); 2665 GST_DEBUG_OBJECT (basesrc, "caps of peer: %" GST_PTR_FORMAT, peercaps); 2666 if (peercaps) { 2667 /* get intersection */ 2668 caps = 2669 gst_caps_intersect_full (peercaps, thiscaps, GST_CAPS_INTERSECT_FIRST); 2670 GST_DEBUG_OBJECT (basesrc, "intersect: %" GST_PTR_FORMAT, caps); 2671 gst_caps_unref (peercaps); 2672 } else { 2673 /* no peer, work with our own caps then */ 2674 caps = gst_caps_copy (thiscaps); 2675 } 2676 gst_caps_unref (thiscaps);
Created attachment 205151 [details] [review] patch basesrc: minor negotiation optimization
I see what has happen. I forgot about a local modification that speeds up caps-nego a bit (attached), and hence the diverge... Sorry about that.
in 0.11 the intersection uses refcounting instead of copy and the filter is done in the getcaps call. For 0.10, I wonder if it is still worth it..
In fact, intersect also just does a copy when caps2 is ANY so this patch doesn't reduce any complexity. closing.