[videofilter] Add new condition in transform function for zero copy buffer 41/229441/2 accepted/tizen/unified/20200403.034505 submit/tizen/20200401.043141
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 1 Apr 2020 05:41:42 +0000 (14:41 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 1 Apr 2020 05:59:34 +0000 (14:59 +0900)
- 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 <jm80.yang@samsung.com>
gst-libs/gst/video/gstvideofilter.c
packaging/gst-plugins-base.spec

index 05961e8..35157ce 100644 (file)
@@ -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);
index 5566f56..781f59b 100644 (file)
@@ -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/