From 86cbbbae2313fbe84e833d64a7f9f0ff94c712b9 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 10 Jun 2004 11:33:05 +0000 Subject: [PATCH] ext/: Fix refcounting bugs Original commit message from CVS: * ext/ogg/gstoggmux.c: (gst_ogg_mux_next_buffer), (gst_ogg_mux_get_headers), (gst_ogg_mux_set_header_on_caps), (gst_ogg_mux_send_headers), (gst_ogg_mux_loop): * ext/theora/theoraenc.c: (theora_enc_chain): Fix refcounting bugs --- ChangeLog | 8 ++++++++ ext/ogg/gstoggmux.c | 12 +++++++++--- ext/theora/theoraenc.c | 4 ---- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index d4d3979feb..d7c1fadb96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-06-10 Wim Taymans + + * ext/ogg/gstoggmux.c: (gst_ogg_mux_next_buffer), + (gst_ogg_mux_get_headers), (gst_ogg_mux_set_header_on_caps), + (gst_ogg_mux_send_headers), (gst_ogg_mux_loop): + * ext/theora/theoraenc.c: (theora_enc_chain): + Fix refcounting bugs + 2004-06-10 Ronald Bultje * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init), diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index ba5d16b9b2..6d1cdf82b5 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -377,8 +377,8 @@ gst_ogg_mux_next_buffer (GstOggPad * pad) GstData *data = NULL; while (data == NULL) { - GST_LOG ("muxer: pulling %s:%s", GST_DEBUG_PAD_NAME (pad->pad)); data = gst_pad_pull (pad->pad); + GST_DEBUG ("muxer: pulled %s:%s %p", GST_DEBUG_PAD_NAME (pad->pad), data); /* if it's an event, handle it */ if (GST_IS_EVENT (data)) { GstEventType type; @@ -409,12 +409,12 @@ gst_ogg_mux_next_buffer (GstOggPad * pad) if (pad->state == GST_OGG_PAD_STATE_CONTROL) { /* and we have one */ if (incaps) { - GST_LOG ("muxer: got incaps buffer in control state, ignoring"); + GST_DEBUG ("muxer: got incaps buffer in control state, ignoring"); /* just ignore */ gst_buffer_unref (buf); data = NULL; } else { - GST_LOG + GST_DEBUG ("muxer: got data buffer in control state, switching to data mode"); /* this is a data buffer so switch to data state */ pad->state = GST_OGG_PAD_STATE_DATA; @@ -568,6 +568,7 @@ gst_ogg_mux_get_headers (GstOggPad * pad) if (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER) { GstBuffer *buf = g_value_peek_pointer (bufval); + gst_buffer_ref (buf); res = g_list_append (res, buf); } } @@ -739,6 +740,8 @@ gst_ogg_mux_send_headers (GstOggMux * mux) } } } + g_list_free (pad->headers); + pad->headers = NULL; } /* hbufs holds all buffers for the headers now */ @@ -757,8 +760,11 @@ gst_ogg_mux_send_headers (GstOggMux * mux) if (GST_PAD_IS_USABLE (mux->srcpad)) { gst_pad_push (mux->srcpad, GST_DATA (buf)); + } else { + gst_buffer_unref (buf); } } + g_list_free (hbufs); } /* basic idea: diff --git a/ext/theora/theoraenc.c b/ext/theora/theoraenc.c index bce58fde4a..ea207c6c41 100644 --- a/ext/theora/theoraenc.c +++ b/ext/theora/theoraenc.c @@ -334,9 +334,6 @@ theora_enc_chain (GstPad * pad, GstData * data) theora_encode_tables (&enc->state, &op); buf3 = theora_buffer_from_packet (enc, &op); - /* create caps */ - caps = gst_caps_new_simple ("video/x-theora", NULL); - /* mark buffers and put on caps */ caps = gst_pad_get_caps (enc->srcpad); theora_set_header_on_caps (caps, buf1, buf2, buf3); @@ -348,7 +345,6 @@ theora_enc_chain (GstPad * pad, GstData * data) gst_data_unref (data); return; } - gst_caps_free (caps); /* push out the header buffers */ theora_push_buffer (enc, buf1);