Commit f8781e3d authored by Christophe Fergeau's avatar Christophe Fergeau

Fix several misuse of gst_buffer_merge (it doesn't take ownership of any...

Fix several misuse of gst_buffer_merge (it doesn't take ownership of any buffer), should fix some leaks. I hope I did...

Original commit message from CVS:
2004-03-06  Christophe Fergeau  <teuf@gnome.org>

* ext/faac/gstfaac.c: (gst_faac_chain):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/libpng/gstpngenc.c: (user_write_data):
* ext/mikmod/gstmikmod.c: (gst_mikmod_loop):
* gst/ac3parse/gstac3parse.c: (gst_ac3parse_chain):
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_chain_subtitle):
* gst/mpegstream/gstrfc2250enc.c: (gst_rfc2250_enc_add_slice):
Fix several misuse of gst_buffer_merge (it doesn't take ownership
of any buffer), should fix some leaks. I hope I didn't unref buffers
that shouldn't be...
parent a11cf2ec
2004-03-06 Christophe Fergeau <teuf@gnome.org>
* ext/faac/gstfaac.c: (gst_faac_chain):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/libpng/gstpngenc.c: (user_write_data):
* ext/mikmod/gstmikmod.c: (gst_mikmod_loop):
* gst/ac3parse/gstac3parse.c: (gst_ac3parse_chain):
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_chain_subtitle):
* gst/mpegstream/gstrfc2250enc.c: (gst_rfc2250_enc_add_slice):
Fix several misuse of gst_buffer_merge (it doesn't take ownership
of any buffer), should fix some leaks. I hope I didn't unref buffers
that shouldn't be...
2004-03-06 Thomas Vander Stichele <thomas at apestaart dot org>
* gst-libs/gst/media-info/media-info-priv.c: (have_type_callback),
......
......@@ -471,9 +471,13 @@ gst_faac_chain (GstPad *pad,
/* do we have enough data for one frame? */
if (in_size / faac->bps < faac->samples) {
if (in_size > size) {
GstBuffer *merge;
/* this is panic! we got a buffer, but still don't have enough
* data. Merge them and retry in the next cycle... */
faac->cache = gst_buffer_merge (faac->cache, inbuf);
merge = gst_buffer_merge (faac->cache, inbuf);
gst_buffer_unref (faac->cache);
gst_buffer_unref (inbuf);
faac->cache = merge;
} else if (in_size == size) {
/* this shouldn't happen, but still... */
faac->cache = inbuf;
......@@ -495,11 +499,15 @@ gst_faac_chain (GstPad *pad,
/* create the frame */
if (in_size > size) {
GstBuffer *merge;
/* merge */
subbuf = gst_buffer_create_sub (inbuf, 0, frame_size - (in_size - size));
GST_BUFFER_DURATION (subbuf) =
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size;
subbuf = gst_buffer_merge (faac->cache, subbuf);
merge = gst_buffer_merge (faac->cache, subbuf);
gst_buffer_unref (faac->cache);
gst_buffer_unref (subbuf);
subbuf = merge;
faac->cache = NULL;
} else {
subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size);
......
......@@ -369,10 +369,11 @@ gst_mpeg2subt_chain_subtitle (GstPad *pad, GstData *_data)
/* deal with partial frame from previous buffer */
if (mpeg2subt->partialbuf) {
mpeg2subt->partialbuf = gst_buffer_merge(mpeg2subt->partialbuf, buf);
/* and the one we received.. */
GstBuffer *merge;
merge = gst_buffer_merge(mpeg2subt->partialbuf, buf);
gst_buffer_unref (mpeg2subt->partialbuf);
gst_buffer_unref(buf);
mpeg2subt->partialbuf = merge;
}
else {
mpeg2subt->partialbuf = buf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment