summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2014-09-12 14:27:44 +0300
committerSebastian Dröge <sebastian@centricular.com>2014-09-13 16:49:23 +0300
commit74d4f2ee74b34e1c4876745423d0dd49022f44e6 (patch)
treee7618f2f6f285d3f14ebf5131fdfc3f7b04b5a62
parentf3ae1be017d50cf5a779ee87cc18739621c446d0 (diff)
downloadgstreamer-plugins-base-74d4f2ee74b34e1c4876745423d0dd49022f44e6.tar.gz
videofilter: Unref buffers before calling the transform_frame functions
GstVideoFrame has another reference, so the buffer looks unwriteable, meaning that we can't attach any metas or anything to it https://bugzilla.gnome.org/show_bug.cgi?id=736118
-rw-r--r--gst-libs/gst/video/gstvideofilter.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c
index a47a1139d..e1fa2c1ba 100644
--- a/gst-libs/gst/video/gstvideofilter.c
+++ b/gst-libs/gst/video/gstvideofilter.c
@@ -267,7 +267,16 @@ gst_video_filter_transform (GstBaseTransform * trans, GstBuffer * inbuf,
GST_MAP_WRITE))
goto invalid_buffer;
+ /* GstVideoFrame has another reference, so the buffer looks unwriteable,
+ * meaning that we can't attach any metas or anything to it. Other
+ * map() functions like gst_buffer_map() don't get another reference
+ * of the buffer and expect the buffer reference to be kept until
+ * the buffer is unmapped again. */
+ gst_buffer_unref (inbuf);
+ gst_buffer_unref (outbuf);
res = fclass->transform_frame (filter, &in_frame, &out_frame);
+ gst_buffer_ref (inbuf);
+ gst_buffer_ref (outbuf);
gst_video_frame_unmap (&out_frame);
gst_video_frame_unmap (&in_frame);
@@ -316,7 +325,14 @@ gst_video_filter_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
if (!gst_video_frame_map (&frame, &filter->in_info, buf, flags))
goto invalid_buffer;
+ /* GstVideoFrame has another reference, so the buffer looks unwriteable,
+ * meaning that we can't attach any metas or anything to it. Other
+ * map() functions like gst_buffer_map() don't get another reference
+ * of the buffer and expect the buffer reference to be kept until
+ * the buffer is unmapped again. */
+ gst_buffer_unref (buf);
res = fclass->transform_frame_ip (filter, &frame);
+ gst_buffer_ref (buf);
gst_video_frame_unmap (&frame);
} else {