From 0de4e9df00e2dfe2671631e696731d84d51d5829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 29 Jun 2009 11:56:59 +0200 Subject: frei0r: In the mixer plugins create the frei0r instances in create() before playback starts --- gst/frei0r/gstfrei0rmixer.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'gst/frei0r/gstfrei0rmixer.c') diff --git a/gst/frei0r/gstfrei0rmixer.c b/gst/frei0r/gstfrei0rmixer.c index 745c330e..684519df 100644 --- a/gst/frei0r/gstfrei0rmixer.c +++ b/gst/frei0r/gstfrei0rmixer.c @@ -195,7 +195,6 @@ static gboolean gst_frei0r_mixer_set_caps (GstPad * pad, GstCaps * caps) { GstFrei0rMixer *self = GST_FREI0R_MIXER (gst_pad_get_parent (pad)); - GstFrei0rMixerClass *klass = GST_FREI0R_MIXER_GET_CLASS (self); gboolean ret = TRUE; gst_caps_replace (&self->caps, caps); @@ -215,16 +214,6 @@ gst_frei0r_mixer_set_caps (GstPad * pad, GstCaps * caps) ret = FALSE; goto out; } - - if (self->f0r_instance) { - klass->ftable->destruct (self->f0r_instance); - self->f0r_instance = NULL; - } - - self->f0r_instance = - gst_frei0r_instance_construct (klass->ftable, klass->properties, - klass->n_properties, self->property_cache, self->width, self->height); - } out: @@ -543,9 +532,17 @@ gst_frei0r_mixer_collected (GstCollectPads * pads, GstFrei0rMixer * self) GstFrei0rMixerClass *klass = GST_FREI0R_MIXER_GET_CLASS (self); gdouble time; - if (G_UNLIKELY (!self->f0r_instance)) + if (G_UNLIKELY (self->width <= 0 || self->height <= 0)) return GST_FLOW_NOT_NEGOTIATED; + if (G_UNLIKELY (!self->f0r_instance)) { + self->f0r_instance = + gst_frei0r_instance_construct (klass->ftable, klass->properties, + klass->n_properties, self->property_cache, self->width, self->height); + if (G_UNLIKELY (!self->f0r_instance)) + return GST_FLOW_ERROR; + } + if (self->newseg_event) { gst_pad_push_event (self->src, self->newseg_event); self->newseg_event = NULL; -- cgit v1.2.1 From 0647d963ef5abcbbe4edbc5a80b87bf84470c6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 29 Jun 2009 12:02:19 +0200 Subject: frei0r: Correctly clean up elements to be reusable and not leak memory --- gst/frei0r/gstfrei0rmixer.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gst/frei0r/gstfrei0rmixer.c') diff --git a/gst/frei0r/gstfrei0rmixer.c b/gst/frei0r/gstfrei0rmixer.c index 684519df..8f3ee4ba 100644 --- a/gst/frei0r/gstfrei0rmixer.c +++ b/gst/frei0r/gstfrei0rmixer.c @@ -45,8 +45,16 @@ gst_frei0r_mixer_reset (GstFrei0rMixer * self) self->f0r_instance = NULL; } + if (self->property_cache) + gst_frei0r_property_cache_free (klass->properties, self->property_cache, + klass->n_properties); + self->property_cache = NULL; + gst_caps_replace (&self->caps, NULL); gst_event_replace (&self->newseg_event, NULL); + + self->fmt = GST_VIDEO_FORMAT_UNKNOWN; + self->width = self->height = 0; } static void -- cgit v1.2.1