From c94ad94f141c8a780118abbf872a86324aaf7ffe Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 1 Apr 2020 14:41:42 +0900 Subject: [PATCH] [videofilter] Add new condition in transform function for zero copy buffer - The input buffer could be zero copy buffer. - SR32 format is also used. [Version] 1.16.2-4 [Profile] Common [Issue Type] Update Change-Id: Ib3e6ecb0504f2019c2dc032fcb27456b68e2d0f8 Signed-off-by: Jeongmo Yang --- gst-libs/gst/video/gstvideofilter.c | 33 ++++++++++++++++++++++++--------- packaging/gst-plugins-base.spec | 2 +- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c index 05961e8..35157ce 100644 --- a/gst-libs/gst/video/gstvideofilter.c +++ b/gst-libs/gst/video/gstvideofilter.c @@ -253,7 +253,7 @@ gst_video_filter_transform (GstBaseTransform * trans, GstBuffer * inbuf, GstVideoFilter *filter = GST_VIDEO_FILTER_CAST (trans); GstVideoFilterClass *fclass; #ifdef USE_TBM - GstMapFlags out_map_flags = GST_MAP_WRITE; + GstMapFlags map_flags; #endif if (G_UNLIKELY (!filter->negotiated)) @@ -263,20 +263,35 @@ gst_video_filter_transform (GstBaseTransform * trans, GstBuffer * inbuf, if (fclass->transform_frame) { GstVideoFrame in_frame, out_frame; - if (!gst_video_frame_map (&in_frame, &filter->in_info, inbuf, - GST_MAP_READ | GST_VIDEO_FRAME_MAP_FLAG_NO_REF)) +#ifdef USE_TBM + map_flags = GST_MAP_READ; + if (filter->in_info.finfo->format != GST_VIDEO_FORMAT_SN12 && + filter->in_info.finfo->format != GST_VIDEO_FORMAT_SR32) + map_flags |= GST_VIDEO_FRAME_MAP_FLAG_NO_REF; + + GST_LOG_OBJECT (trans, "IN format %d, flags 0x%x", + filter->in_info.finfo->format, map_flags); + + if (!gst_video_frame_map (&in_frame, &filter->in_info, inbuf, map_flags)) goto invalid_buffer; -#ifdef USE_TBM - if (filter->out_info.finfo->format != GST_VIDEO_FORMAT_SN12) - out_map_flags |= GST_VIDEO_FRAME_MAP_FLAG_NO_REF; + map_flags = GST_MAP_WRITE; + if (filter->out_info.finfo->format != GST_VIDEO_FORMAT_SN12 && + filter->out_info.finfo->format != GST_VIDEO_FORMAT_SR32) + map_flags |= GST_VIDEO_FRAME_MAP_FLAG_NO_REF; - if (!gst_video_frame_map (&out_frame, &filter->out_info, outbuf, - out_map_flags)) { + GST_LOG_OBJECT (trans, "OUT format %d, flags 0x%x", + filter->out_info.finfo->format, map_flags); + + if (!gst_video_frame_map (&out_frame, &filter->out_info, outbuf, map_flags)) { gst_video_frame_unmap (&in_frame); goto invalid_buffer; - } + } #else + if (!gst_video_frame_map (&in_frame, &filter->in_info, inbuf, + GST_MAP_READ | GST_VIDEO_FRAME_MAP_FLAG_NO_REF)) + goto invalid_buffer; + if (!gst_video_frame_map (&out_frame, &filter->out_info, outbuf, GST_MAP_WRITE | GST_VIDEO_FRAME_MAP_FLAG_NO_REF)) { gst_video_frame_unmap (&in_frame); diff --git a/packaging/gst-plugins-base.spec b/packaging/gst-plugins-base.spec index 5566f56..781f59b 100644 --- a/packaging/gst-plugins-base.spec +++ b/packaging/gst-plugins-base.spec @@ -5,7 +5,7 @@ Name: gst-plugins-base Version: 1.16.2 -Release: 3 +Release: 4 License: LGPL-2.0+ Summary: GStreamer Streaming-Media Framework Plug-Ins Url: http://gstreamer.freedesktop.org/ -- 2.7.4