summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author <sjoerd@luon.net>2008-08-05 11:30:57 (GMT)
committer <sjoerd@luon.net>2008-08-05 11:30:57 (GMT)
commit65dd460f0a3a9c4882e638c86208f74ef62c3460 (patch)
tree2a85448581bbd8177c0d142037cfe16a2d91761d
parentc4b2ff33008e307b15c50d7fdd69355d44f17f74 (diff)
downloadgst-plugins-farsight-tester-65dd460f0a3a9c4882e638c86208f74ef62c3460.tar.gz
gst-plugins-farsight-tester-65dd460f0a3a9c4882e638c86208f74ef62c3460.tar.xz
Fix refcounting issues in prepare_output_buffer
20080805113057-be0f2-9dc270781f0a0f21c616ed11dbd1f198fd1b326e.gz
-rw-r--r--gst/valve/gstvalve.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/gst/valve/gstvalve.c b/gst/valve/gstvalve.c
index c0f4163..d70f8ba 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));