summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-08-05 13:46:42 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-08-06 10:52:45 +0200
commit04f3f096c36a97961d52dd9b2042c810e297215b (patch)
tree961c595fffc9d7965ee5c9d50501efa519bdf775 /plugins
parent6cf64beb79f18d3956e18d59860fe4b0eb7bfe35 (diff)
capsfilter: fix refcounting problem
Make sure the metadata is writable before setting the caps on a buffer.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/elements/gstcapsfilter.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/elements/gstcapsfilter.c b/plugins/elements/gstcapsfilter.c
index 1a02b84ed2..9d7a81ae16 100644
--- a/plugins/elements/gstcapsfilter.c
+++ b/plugins/elements/gstcapsfilter.c
@@ -306,9 +306,15 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input,
/* FIXME : Move this behaviour to basetransform. The given caps are the ones
* of the source pad, therefore our outgoing buffers should always have
* those caps. */
- gst_buffer_set_caps (input, caps);
- gst_buffer_ref (input);
- *buf = input;
+ if (gst_buffer_is_metadata_writable (input)) {
+ *buf = input;
+ gst_buffer_set_caps (*buf, caps);
+ gst_buffer_ref (input);
+ } else {
+ GST_DEBUG_OBJECT (trans, "Creating sub-buffer and setting caps");
+ *buf = gst_buffer_create_sub (input, 0, GST_BUFFER_SIZE (input));
+ gst_buffer_set_caps (*buf, caps);
+ }
} else {
/* Buffer has no caps. See if the output pad only supports fixed caps */
GstCaps *out_caps;