summaryrefslogtreecommitdiffstats
path: root/ext/faac
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2004-03-06 20:56:28 +0000
committerChristophe Fergeau <teuf@gnome.org>2004-03-06 20:56:28 +0000
commitf8781e3de80c7602f854e98d16ba72e7427e8887 (patch)
tree9c9434f16d84685c87595b84152d5886d58c3ddd /ext/faac
parenta11cf2ec0a951b954857ebfa83abbfa4ac6db77e (diff)
downloadgst-plugins-bad-f8781e3de80c7602f854e98d16ba72e7427e8887.tar.gz
gst-plugins-bad-f8781e3de80c7602f854e98d16ba72e7427e8887.tar.bz2
gst-plugins-bad-f8781e3de80c7602f854e98d16ba72e7427e8887.zip
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...
Diffstat (limited to 'ext/faac')
-rw-r--r--ext/faac/gstfaac.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c
index 01eb03ad..7f536275 100644
--- a/ext/faac/gstfaac.c
+++ b/ext/faac/gstfaac.c
@@ -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);