gst-libs/gst/audio/gstaudiosink.c: Fix leak.

Original commit message from CVS:
* gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func),
(gst_audioringbuffer_finalize), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_release), (gst_audioringbuffer_stop):
Fix leak.
Avoid type casting when we can.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_dispose):
Fix mem leak.
This commit is contained in:
Wim Taymans 2006-07-21 10:43:54 +00:00
parent f82bb0c84e
commit 843202b51c
3 changed files with 23 additions and 4 deletions

View file

@ -1,3 +1,14 @@
2006-07-21 Wim Taymans <wim@fluendo.com>
* gst-libs/gst/audio/gstaudiosink.c: (audioringbuffer_thread_func),
(gst_audioringbuffer_finalize), (gst_audioringbuffer_acquire),
(gst_audioringbuffer_release), (gst_audioringbuffer_stop):
Fix leak.
Avoid type casting when we can.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_dispose):
Fix mem leak.
2006-07-20 Tim-Philipp Müller <tim at centricular dot net>
* ext/alsa/gstalsamixerelement.c:

View file

@ -35,6 +35,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_audio_sink_debug);
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIORING_BUFFER,GstAudioRingBufferClass))
#define GST_AUDIORING_BUFFER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AUDIORING_BUFFER, GstAudioRingBufferClass))
#define GST_AUDIORING_BUFFER_CAST(obj) \
((GstAudioRingBuffer *)obj)
#define GST_IS_AUDIORING_BUFFER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIORING_BUFFER))
#define GST_IS_AUDIORING_BUFFER_CLASS(obj)\
@ -152,7 +154,7 @@ audioringbuffer_thread_func (GstRingBuffer * buf)
{
GstAudioSink *sink;
GstAudioSinkClass *csink;
GstAudioRingBuffer *abuf = GST_AUDIORING_BUFFER (buf);
GstAudioRingBuffer *abuf = GST_AUDIORING_BUFFER_CAST (buf);
WriteFunc writefunc;
sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
@ -242,6 +244,10 @@ gst_audioringbuffer_dispose (GObject * object)
static void
gst_audioringbuffer_finalize (GObject * object)
{
GstAudioRingBuffer *ringbuffer = GST_AUDIORING_BUFFER_CAST (object);
g_cond_free (ringbuffer->cond);
G_OBJECT_CLASS (ring_parent_class)->finalize (object);
}
@ -318,7 +324,7 @@ gst_audioringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
abuf = GST_AUDIORING_BUFFER (buf);
abuf = GST_AUDIORING_BUFFER_CAST (buf);
abuf->running = TRUE;
sink->thread =
@ -346,7 +352,7 @@ gst_audioringbuffer_release (GstRingBuffer * buf)
sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
csink = GST_AUDIO_SINK_GET_CLASS (sink);
abuf = GST_AUDIORING_BUFFER (buf);
abuf = GST_AUDIORING_BUFFER_CAST (buf);
abuf->running = FALSE;
GST_DEBUG ("signal wait");
@ -418,7 +424,7 @@ gst_audioringbuffer_stop (GstRingBuffer * buf)
sink = GST_AUDIO_SINK (GST_OBJECT_PARENT (buf));
csink = GST_AUDIO_SINK_GET_CLASS (sink);
abuf = GST_AUDIORING_BUFFER (buf);
abuf = GST_AUDIORING_BUFFER_CAST (buf);
/* unblock any pending writes to the audio device */
if (csink->reset) {

View file

@ -116,6 +116,8 @@ gst_ring_buffer_dispose (GObject * object)
{
GstRingBuffer *ringbuffer = GST_RING_BUFFER (object);
gst_caps_replace (&ringbuffer->spec.caps, NULL);
G_OBJECT_CLASS (parent_class)->dispose (G_OBJECT (ringbuffer));
}