From ab22f339e6adc6ab199c3537f01a6e940f77b830 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 12 Jul 2018 13:53:44 -0400 Subject: [PATCH] track: Set restriction caps when update_restriction before caps being set And stop leaking intermediary restriction caps. https://bugzilla.gnome.org/show_bug.cgi?id=796802 --- ges/ges-track.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ges/ges-track.c b/ges/ges-track.c index 1b86ec4839..7ad5529440 100644 --- a/ges/ges-track.c +++ b/ges/ges-track.c @@ -850,8 +850,16 @@ void ges_track_update_restriction_caps (GESTrack * self, const GstCaps * caps) { guint i; - GstCaps *new_restriction_caps = gst_caps_copy (self->priv->restriction_caps); + GstCaps *new_restriction_caps; + g_return_if_fail (GES_IS_TRACK (self)); + + if (!self->priv->restriction_caps) { + ges_track_set_restriction_caps (self, caps); + return; + } + + new_restriction_caps = gst_caps_copy (self->priv->restriction_caps); for (i = 0; i < gst_caps_get_size (caps); i++) { GstStructure *new = gst_caps_get_structure (caps, i); @@ -865,6 +873,7 @@ ges_track_update_restriction_caps (GESTrack * self, const GstCaps * caps) } ges_track_set_restriction_caps (self, new_restriction_caps); + gst_caps_unref (new_restriction_caps); } /**