Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | From 3a7cdcdfc9c5b0d20394fe51b3b8cda23931ca6d Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com> |
| 3 | Date: Fri, 12 Sep 2014 14:41:01 +0300 |
| 4 | Subject: [PATCH 3/3] videofilter: Use new GST_VIDEO_FRAME_MAP_FLAG_NO_REF |
| 5 | |
| 6 | Upstream-Status: Backport [1.5.1] |
| 7 | https://bugzilla.gnome.org/show_bug.cgi?id=736118 |
| 8 | --- |
| 9 | gst-libs/gst/video/gstvideofilter.c | 23 ++++------------------- |
| 10 | 1 file changed, 4 insertions(+), 19 deletions(-) |
| 11 | |
| 12 | diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c |
| 13 | index e1fa2c1..874b2e8 100644 |
| 14 | --- a/gst-libs/gst/video/gstvideofilter.c |
| 15 | +++ b/gst-libs/gst/video/gstvideofilter.c |
| 16 | @@ -260,23 +260,15 @@ gst_video_filter_transform (GstBaseTransform * trans, GstBuffer * inbuf, |
| 17 | if (fclass->transform_frame) { |
| 18 | GstVideoFrame in_frame, out_frame; |
| 19 | |
| 20 | - if (!gst_video_frame_map (&in_frame, &filter->in_info, inbuf, GST_MAP_READ)) |
| 21 | + if (!gst_video_frame_map (&in_frame, &filter->in_info, inbuf, |
| 22 | + GST_MAP_READ | GST_VIDEO_FRAME_MAP_FLAG_NO_REF)) |
| 23 | goto invalid_buffer; |
| 24 | |
| 25 | if (!gst_video_frame_map (&out_frame, &filter->out_info, outbuf, |
| 26 | - GST_MAP_WRITE)) |
| 27 | + GST_MAP_WRITE | GST_VIDEO_FRAME_MAP_FLAG_NO_REF)) |
| 28 | goto invalid_buffer; |
| 29 | |
| 30 | - /* GstVideoFrame has another reference, so the buffer looks unwriteable, |
| 31 | - * meaning that we can't attach any metas or anything to it. Other |
| 32 | - * map() functions like gst_buffer_map() don't get another reference |
| 33 | - * of the buffer and expect the buffer reference to be kept until |
| 34 | - * the buffer is unmapped again. */ |
| 35 | - gst_buffer_unref (inbuf); |
| 36 | - gst_buffer_unref (outbuf); |
| 37 | res = fclass->transform_frame (filter, &in_frame, &out_frame); |
| 38 | - gst_buffer_ref (inbuf); |
| 39 | - gst_buffer_ref (outbuf); |
| 40 | |
| 41 | gst_video_frame_unmap (&out_frame); |
| 42 | gst_video_frame_unmap (&in_frame); |
| 43 | @@ -317,7 +309,7 @@ gst_video_filter_transform_ip (GstBaseTransform * trans, GstBuffer * buf) |
| 44 | GstVideoFrame frame; |
| 45 | GstMapFlags flags; |
| 46 | |
| 47 | - flags = GST_MAP_READ; |
| 48 | + flags = GST_MAP_READ | GST_VIDEO_FRAME_MAP_FLAG_NO_REF; |
| 49 | |
| 50 | if (!gst_base_transform_is_passthrough (trans)) |
| 51 | flags |= GST_MAP_WRITE; |
| 52 | @@ -325,14 +317,7 @@ gst_video_filter_transform_ip (GstBaseTransform * trans, GstBuffer * buf) |
| 53 | if (!gst_video_frame_map (&frame, &filter->in_info, buf, flags)) |
| 54 | goto invalid_buffer; |
| 55 | |
| 56 | - /* GstVideoFrame has another reference, so the buffer looks unwriteable, |
| 57 | - * meaning that we can't attach any metas or anything to it. Other |
| 58 | - * map() functions like gst_buffer_map() don't get another reference |
| 59 | - * of the buffer and expect the buffer reference to be kept until |
| 60 | - * the buffer is unmapped again. */ |
| 61 | - gst_buffer_unref (buf); |
| 62 | res = fclass->transform_frame_ip (filter, &frame); |
| 63 | - gst_buffer_ref (buf); |
| 64 | |
| 65 | gst_video_frame_unmap (&frame); |
| 66 | } else { |
| 67 | -- |
| 68 | 1.7.9.5 |
| 69 | |