video-transition: Fix GstPad leak

Returned Gstpad by link_element_to_mixer_with_smpte()
has increased refcount in ges_smart_mixer_get_mixer_pad().
This commit is contained in:
Yeongjin Jeong 2019-01-25 18:21:43 +09:00
parent c750345c75
commit e36ae315dc

View file

@ -209,21 +209,20 @@ ges_video_transition_init (GESVideoTransition * self)
} }
static void static void
release_mixer (GstElement ** mixer, GstPad ** sinka, GstPad ** sinkb) ges_video_transition_release_mixer (GESVideoTransition * self)
{ {
if (*sinka && *sinkb) { GESVideoTransitionPrivate *priv = self->priv;
gst_element_release_request_pad (*mixer, *sinka);
gst_element_release_request_pad (*mixer, *sinkb); if (priv->mixer_ghosta && priv->mixer_ghostb) {
gst_object_unref (*sinka); gst_element_release_request_pad (priv->mixer, priv->mixer_ghosta);
gst_object_unref (*sinkb); gst_element_release_request_pad (priv->mixer, priv->mixer_ghostb);
*sinka = NULL; gst_clear_object (&priv->mixer_ghosta);
*sinkb = NULL; gst_clear_object (&priv->mixer_ghostb);
} }
if (*mixer) { gst_clear_object (&priv->mixer_sinka);
gst_object_unref (*mixer); gst_clear_object (&priv->mixer_sinkb);
*mixer = NULL; gst_clear_object (&priv->mixer);
}
} }
static void static void
@ -249,7 +248,7 @@ ges_video_transition_dispose (GObject * object)
priv->smpte_control_source = NULL; priv->smpte_control_source = NULL;
} }
release_mixer (&priv->mixer, &priv->mixer_ghosta, &priv->mixer_ghostb); ges_video_transition_release_mixer (self);
g_signal_handlers_disconnect_by_func (GES_TRACK_ELEMENT (self), g_signal_handlers_disconnect_by_func (GES_TRACK_ELEMENT (self),
duration_changed_cb, NULL); duration_changed_cb, NULL);