diff --git a/ChangeLog b/ChangeLog index c4a70a98a3..9b42d0ff91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-08-26 Jan Schmidt + + * ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose): + * ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init), + (vorbisdec_finalize), (vorbis_handle_type_packet): + Big shout-out to MikeS for fixing this giant memory leak. + Huzzah! + 2005-08-25 Thomas Vander Stichele * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_dispose), diff --git a/common b/common index aa2a757c58..7c93670c50 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit aa2a757c587d91069a230d8e656481c3c364ccc6 +Subproject commit 7c93670c50de2b6e9d8edd31737c636192fbd831 diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 273c47e11b..40cf3d72b7 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -275,6 +275,9 @@ gst_ogg_pad_dispose (GObject * object) { GstOggPad *pad = GST_OGG_PAD (object); + if (pad->element) + gst_element_set_state (pad->element, GST_STATE_NULL); + gst_object_replace ((GstObject **) (&pad->elem_pad), NULL); gst_object_replace ((GstObject **) (&pad->element), NULL); gst_object_replace ((GstObject **) (&pad->elem_out), NULL); diff --git a/ext/vorbis/vorbisdec.c b/ext/vorbis/vorbisdec.c index 0944386279..75f9d0a5ab 100644 --- a/ext/vorbis/vorbisdec.c +++ b/ext/vorbis/vorbisdec.c @@ -72,6 +72,7 @@ GST_STATIC_PAD_TEMPLATE ("sink", GST_BOILERPLATE (GstVorbisDec, gst_vorbis_dec, GstElement, GST_TYPE_ELEMENT); +static void vorbisdec_finalize (GObject * object); static gboolean vorbis_dec_sink_event (GstPad * pad, GstEvent * event); static GstFlowReturn vorbis_dec_chain (GstPad * pad, GstBuffer * buffer); static GstElementStateReturn vorbis_dec_change_state (GstElement * element); @@ -103,8 +104,11 @@ gst_vorbis_dec_base_init (gpointer g_class) static void gst_vorbis_dec_class_init (GstVorbisDecClass * klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); + gobject_class->finalize = vorbisdec_finalize; + gstelement_class->change_state = vorbis_dec_change_state; } @@ -175,6 +179,20 @@ gst_vorbis_dec_init (GstVorbisDec * dec) dec->queued = NULL; } +static void +vorbisdec_finalize (GObject * object) +{ + /* Release any possibly allocated libvorbis data. + * _clear functions can safely be called multiple times + */ + GstVorbisDec *vd = GST_VORBIS_DEC (object); + + vorbis_block_clear (&vd->vb); + vorbis_dsp_clear (&vd->vd); + vorbis_comment_clear (&vd->vc); + vorbis_info_clear (&vd->vi); +} + static gboolean vorbis_dec_convert (GstPad * pad, GstFormat src_format, gint64 src_value, @@ -598,6 +616,8 @@ vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet) static GstFlowReturn vorbis_handle_type_packet (GstVorbisDec * vd) { + g_assert (vd->initialized == FALSE); + vorbis_synthesis_init (&vd->vd, &vd->vi); vorbis_block_init (&vd->vd, &vd->vb); vd->initialized = TRUE;