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
This commit is contained in:
Wim Taymans 2004-06-10 11:33:05 +00:00
parent 01f49018b6
commit 86cbbbae23
3 changed files with 17 additions and 7 deletions

View file

@ -1,3 +1,11 @@
2004-06-10 Wim Taymans <wim@fluendo.com>
* 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 <rbultje@ronald.bitfreak.net> 2004-06-10 Ronald Bultje <rbultje@ronald.bitfreak.net>
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init), * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_init),

View file

@ -377,8 +377,8 @@ gst_ogg_mux_next_buffer (GstOggPad * pad)
GstData *data = NULL; GstData *data = NULL;
while (data == NULL) { while (data == NULL) {
GST_LOG ("muxer: pulling %s:%s", GST_DEBUG_PAD_NAME (pad->pad));
data = gst_pad_pull (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 it's an event, handle it */
if (GST_IS_EVENT (data)) { if (GST_IS_EVENT (data)) {
GstEventType type; GstEventType type;
@ -409,12 +409,12 @@ gst_ogg_mux_next_buffer (GstOggPad * pad)
if (pad->state == GST_OGG_PAD_STATE_CONTROL) { if (pad->state == GST_OGG_PAD_STATE_CONTROL) {
/* and we have one */ /* and we have one */
if (incaps) { if (incaps) {
GST_LOG ("muxer: got incaps buffer in control state, ignoring"); GST_DEBUG ("muxer: got incaps buffer in control state, ignoring");
/* just ignore */ /* just ignore */
gst_buffer_unref (buf); gst_buffer_unref (buf);
data = NULL; data = NULL;
} else { } else {
GST_LOG GST_DEBUG
("muxer: got data buffer in control state, switching to data mode"); ("muxer: got data buffer in control state, switching to data mode");
/* this is a data buffer so switch to data state */ /* this is a data buffer so switch to data state */
pad->state = GST_OGG_PAD_STATE_DATA; 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) { if (G_VALUE_TYPE (bufval) == GST_TYPE_BUFFER) {
GstBuffer *buf = g_value_peek_pointer (bufval); GstBuffer *buf = g_value_peek_pointer (bufval);
gst_buffer_ref (buf);
res = g_list_append (res, 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 */ /* 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)) { if (GST_PAD_IS_USABLE (mux->srcpad)) {
gst_pad_push (mux->srcpad, GST_DATA (buf)); gst_pad_push (mux->srcpad, GST_DATA (buf));
} else {
gst_buffer_unref (buf);
} }
} }
g_list_free (hbufs);
} }
/* basic idea: /* basic idea:

View file

@ -334,9 +334,6 @@ theora_enc_chain (GstPad * pad, GstData * data)
theora_encode_tables (&enc->state, &op); theora_encode_tables (&enc->state, &op);
buf3 = theora_buffer_from_packet (enc, &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 */ /* mark buffers and put on caps */
caps = gst_pad_get_caps (enc->srcpad); caps = gst_pad_get_caps (enc->srcpad);
theora_set_header_on_caps (caps, buf1, buf2, buf3); theora_set_header_on_caps (caps, buf1, buf2, buf3);
@ -348,7 +345,6 @@ theora_enc_chain (GstPad * pad, GstData * data)
gst_data_unref (data); gst_data_unref (data);
return; return;
} }
gst_caps_free (caps);
/* push out the header buffers */ /* push out the header buffers */
theora_push_buffer (enc, buf1); theora_push_buffer (enc, buf1);