mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
Add a finalize method to ensure we clean up state even if someone omitted the state change back to NULL.
Original commit message from CVS: (theora_enc_finalize), (theora_enc_sink_setcaps): Add a finalize method to ensure we clean up state even if someone omitted the state change back to NULL. * ext/vorbis/vorbisenc.c: (gst_vorbisenc_metadata_set1), (gst_vorbisenc_chain): Free some more leaked bits. * tests/check/pipelines/theoraenc.c: (start_pipeline), (stop_pipeline): Wait for state changes to happen if they're ASYNC. This ought to teach those fancy pants buildbots a lesson.
This commit is contained in:
parent
a81e97c96e
commit
5109622dd0
4 changed files with 49 additions and 3 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
2006-02-06 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* ext/theora/theoraenc.c: (gst_theora_enc_class_init),
|
||||
(theora_enc_finalize), (theora_enc_sink_setcaps):
|
||||
Add a finalize method to ensure we clean up state even if
|
||||
someone omitted the state change back to NULL.
|
||||
|
||||
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_metadata_set1),
|
||||
(gst_vorbisenc_chain):
|
||||
Free some more leaked bits.
|
||||
|
||||
* tests/check/pipelines/theoraenc.c: (start_pipeline),
|
||||
(stop_pipeline):
|
||||
Wait for state changes to happen if they're ASYNC.
|
||||
|
||||
This ought to teach those fancy pants buildbots a lesson.
|
||||
|
||||
2006-02-05 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* gst-libs/gst/tag/gstid3tag.c:
|
||||
|
|
|
@ -148,6 +148,7 @@ static void theora_enc_get_property (GObject * object, guint prop_id,
|
|||
GValue * value, GParamSpec * pspec);
|
||||
static void theora_enc_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void theora_enc_finalize (GObject * object);
|
||||
|
||||
static void
|
||||
gst_theora_enc_base_init (gpointer g_class)
|
||||
|
@ -169,6 +170,7 @@ gst_theora_enc_class_init (GstTheoraEncClass * klass)
|
|||
|
||||
gobject_class->set_property = theora_enc_set_property;
|
||||
gobject_class->get_property = theora_enc_get_property;
|
||||
gobject_class->finalize = theora_enc_finalize;
|
||||
|
||||
g_object_class_install_property (gobject_class, ARG_CENTER,
|
||||
g_param_spec_boolean ("center", "Center",
|
||||
|
@ -256,6 +258,16 @@ gst_theora_enc_init (GstTheoraEnc * enc, GstTheoraEncClass * g_class)
|
|||
enc->info.keyframe_frequency_force, enc->granule_shift);
|
||||
}
|
||||
|
||||
static void
|
||||
theora_enc_finalize (GObject * object)
|
||||
{
|
||||
GstTheoraEnc *enc = GST_THEORA_ENC (object);
|
||||
|
||||
theora_clear (&enc->state);
|
||||
theora_comment_clear (&enc->comment);
|
||||
theora_info_clear (&enc->info);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||
{
|
||||
|
@ -324,6 +336,8 @@ theora_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
|
||||
theora_encode_init (&enc->state, &enc->info);
|
||||
|
||||
gst_object_unref (enc);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -613,6 +613,7 @@ gst_vorbisenc_metadata_set1 (const GstTagList * list, const gchar * tag,
|
|||
|
||||
vorbis_comment_add_tag (&enc->vc, tmptag, vorbisvalue);
|
||||
g_free (tmptag);
|
||||
g_free (vorbisvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -968,6 +969,7 @@ gst_vorbisenc_chain (GstPad * pad, GstBuffer * buffer)
|
|||
gst_vorbisenc_set_metadata (vorbisenc);
|
||||
vorbis_analysis_headerout (&vorbisenc->vd, &vorbisenc->vc, &header,
|
||||
&header_comm, &header_code);
|
||||
vorbis_comment_clear (&vorbisenc->vc);
|
||||
|
||||
/* create header buffers */
|
||||
buf1 = gst_vorbisenc_buffer_from_header_packet (vorbisenc, &header);
|
||||
|
|
|
@ -56,13 +56,19 @@ buffer_probe (GstPad * pad, GstBuffer * buffer, gpointer unused)
|
|||
static void
|
||||
start_pipeline (GstElement * bin, GstPad * pad)
|
||||
{
|
||||
GstStateChangeReturn ret;
|
||||
|
||||
id = gst_pad_add_buffer_probe (pad, G_CALLBACK (buffer_probe), NULL);
|
||||
|
||||
cond = g_cond_new ();
|
||||
lock = g_mutex_new ();
|
||||
|
||||
gst_element_set_state (bin, GST_STATE_PLAYING);
|
||||
|
||||
ret = gst_element_set_state (bin, GST_STATE_PLAYING);
|
||||
fail_if (ret == GST_STATE_CHANGE_FAILURE, "Could not start test pipeline");
|
||||
if (ret == GST_STATE_CHANGE_ASYNC) {
|
||||
ret = gst_element_get_state (bin, NULL, NULL, GST_CLOCK_TIME_NONE);
|
||||
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "Could not start test pipeline");
|
||||
}
|
||||
}
|
||||
|
||||
/* waits until the probe receives a buffer. will catch every buffer */
|
||||
|
@ -89,6 +95,8 @@ get_buffer (GstElement * bin, GstPad * pad)
|
|||
static void
|
||||
stop_pipeline (GstElement * bin, GstPad * pad)
|
||||
{
|
||||
GstStateChangeReturn ret;
|
||||
|
||||
g_mutex_lock (lock);
|
||||
if (buf)
|
||||
gst_buffer_unref (buf);
|
||||
|
@ -98,7 +106,12 @@ stop_pipeline (GstElement * bin, GstPad * pad)
|
|||
g_cond_signal (cond);
|
||||
g_mutex_unlock (lock);
|
||||
|
||||
gst_element_set_state (bin, GST_STATE_NULL);
|
||||
ret = gst_element_set_state (bin, GST_STATE_NULL);
|
||||
fail_if (ret == GST_STATE_CHANGE_FAILURE, "Could not stop test pipeline");
|
||||
if (ret == GST_STATE_CHANGE_ASYNC) {
|
||||
ret = gst_element_get_state (bin, NULL, NULL, GST_CLOCK_TIME_NONE);
|
||||
fail_if (ret != GST_STATE_CHANGE_SUCCESS, "Could not stop test pipeline");
|
||||
}
|
||||
|
||||
g_mutex_lock (lock);
|
||||
if (buf)
|
||||
|
|
Loading…
Reference in a new issue