diff options
author | Edward Hervey <bilboed@bilboed.com> | 2005-12-07 11:46:15 +0000 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2005-12-07 11:46:15 +0000 |
commit | bf3ce4ca5dcbd45df80f9ca485a07d9485f44e22 (patch) | |
tree | fdabd968ad438465dc53fa1f981ab875026165d4 /gst/qtdemux | |
parent | bdb814f6ef56edca67e1241eb16df22fdd8ab17c (diff) | |
download | gst-plugins-bad-bf3ce4ca5dcbd45df80f9ca485a07d9485f44e22.tar.gz gst-plugins-bad-bf3ce4ca5dcbd45df80f9ca485a07d9485f44e22.tar.bz2 gst-plugins-bad-bf3ce4ca5dcbd45df80f9ca485a07d9485f44e22.zip |
gst/qtdemux/qtdemux.c: Memleak fixes.
Original commit message from CVS:
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
(gst_qtdemux_add_stream):
Memleak fixes.
Send out EOS for valid reasons (couldn't pull_range() from upstream
for example).
Diffstat (limited to 'gst/qtdemux')
-rw-r--r-- | gst/qtdemux/qtdemux.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 16417f1c..cfd2c7f7 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -493,7 +493,7 @@ gst_qtdemux_loop_header (GstPad * pad) guint8 *data; guint32 length; guint32 fourcc; - GstBuffer *buf; + GstBuffer *buf = NULL; int offset; guint64 cur_offset; int size; @@ -507,13 +507,15 @@ gst_qtdemux_loop_header (GstPad * pad) case QTDEMUX_STATE_HEADER:{ if (gst_pad_pull_range (qtdemux->sinkpad, cur_offset, 16, &buf) != GST_FLOW_OK) - goto pause; + goto error; data = GST_BUFFER_DATA (buf); length = GST_READ_UINT32_BE (data); GST_DEBUG ("length %08x", length); fourcc = GST_READ_UINT32_LE (data + 4); GST_DEBUG ("atom type %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc)); + gst_buffer_unref (buf); + if (length == 0) { length = G_MAXUINT32; //gst_bytestream_length (qtdemux->bs) - cur_offset; } @@ -543,7 +545,7 @@ gst_qtdemux_loop_header (GstPad * pad) if (gst_pad_pull_range (qtdemux->sinkpad, cur_offset, length, &moov) != GST_FLOW_OK) - goto pause; + goto error; cur_offset += length; qtdemux->offset += length; @@ -621,7 +623,7 @@ gst_qtdemux_loop_header (GstPad * pad) buf = NULL; if (gst_pad_pull_range (qtdemux->sinkpad, offset, size, &buf) != GST_FLOW_OK) - goto pause; + goto error; if (buf) { /* hum... FIXME changing framerate breaks horribly, better set @@ -672,7 +674,7 @@ gst_qtdemux_loop_header (GstPad * pad) gst_buffer_set_caps (buf, stream->caps); ret = gst_pad_push (stream->pad, buf); if (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED) - goto pause; + goto error; GST_INFO ("pushing buffer on %" GST_PTR_FORMAT, stream->pad); } @@ -686,9 +688,10 @@ gst_qtdemux_loop_header (GstPad * pad) return; -pause: - GST_LOG_OBJECT (qtdemux, "pausing task"); +error: + GST_LOG_OBJECT (qtdemux, "pausing task and sending EOS"); gst_pad_pause_task (qtdemux->sinkpad); + gst_pad_event_default (qtdemux->sinkpad, gst_event_new_eos ()); return; } @@ -722,11 +725,12 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, gchar *caps; if (stream->subtype == GST_MAKE_FOURCC ('v', 'i', 'd', 'e')) { + GstPadTemplate *templ; gchar *name = g_strdup_printf ("video_%02d", qtdemux->n_video_streams); - stream->pad = - gst_pad_new_from_template (gst_static_pad_template_get - (&gst_qtdemux_videosrc_template), name); + templ = gst_static_pad_template_get (&gst_qtdemux_videosrc_template); + stream->pad = gst_pad_new_from_template (templ, name); + gst_object_unref (templ); g_free (name); stream->fps_n = stream->timescale; stream->fps_d = stream->samples[0].duration; @@ -771,7 +775,7 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux, gst_pad_set_caps (stream->pad, stream->caps); GST_DEBUG ("adding pad %s %p to qtdemux %p", - gst_pad_get_name (stream->pad), stream->pad, qtdemux); + GST_OBJECT_NAME (stream->pad), stream->pad, qtdemux); gst_element_add_pad (GST_ELEMENT (qtdemux), stream->pad); if (list) { gst_element_found_tags_for_pad (GST_ELEMENT (qtdemux), stream->pad, list); |