diff options
author | sjoerd@luon.net <sjoerd@luon.net> | 2008-08-05 11:30:57 +0000 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2009-02-17 19:29:59 +0100 |
commit | d2a43636b9b6cd9d328469bc028d3b3169d52d6c (patch) | |
tree | 0eb6c0848229613097698d4094548804c7cb80bd /gst | |
parent | c7d7a158cbf15b5b5a6e9bc126676e510edccc47 (diff) | |
download | gst-plugins-bad-d2a43636b9b6cd9d328469bc028d3b3169d52d6c.tar.gz gst-plugins-bad-d2a43636b9b6cd9d328469bc028d3b3169d52d6c.tar.bz2 gst-plugins-bad-d2a43636b9b6cd9d328469bc028d3b3169d52d6c.zip |
[MOVED FROM GST-P-FARSIGHT] Fix refcounting issues in prepare_output_buffer
20080805113057-be0f2-9dc270781f0a0f21c616ed11dbd1f198fd1b326e.gz
Diffstat (limited to 'gst')
-rw-r--r-- | gst/valve/gstvalve.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gst/valve/gstvalve.c b/gst/valve/gstvalve.c index c0f41632..d70f8ba2 100644 --- a/gst/valve/gstvalve.c +++ b/gst/valve/gstvalve.c @@ -212,18 +212,25 @@ gst_valve_prepare_output_buffer (GstBaseTransform *trans, GstBuffer * in_buf, } else { + /* Always return a reffed buffer, which in case of returning the input + * buffer means adding an extra ref to it */ if (valve->discont) { - *out_buf = gst_buffer_make_metadata_writable (in_buf); + if (gst_buffer_is_metadata_writable (in_buf)) + { + *out_buf = gst_buffer_ref (in_buf); + } + else + { + *out_buf = gst_buffer_create_sub (in_buf, 0, GST_BUFFER_SIZE (in_buf)); + } GST_BUFFER_FLAG_SET (*out_buf, GST_BUFFER_FLAG_DISCONT); valve->discont = FALSE; - } else { - *out_buf = in_buf; + *out_buf = gst_buffer_ref(in_buf); } - gst_buffer_ref (*out_buf); } GST_OBJECT_UNLOCK (GST_OBJECT (trans)); |