[video360] Fix 2 bugs 37/229437/1 accepted/tizen/unified/20200402.155419 submit/tizen/20200402.040110
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 1 Apr 2020 05:20:34 +0000 (14:20 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 1 Apr 2020 05:20:34 +0000 (14:20 +0900)
1. Remove invalid buffer referencing
 : It seems that the additional buffer referencing is needed because of bug in gstvideofilter,
   But, it's fixed and now, this buffer referencing code causes buffer handling error after that.
   So, the buffer referencing code should be removed.

2. Correct passthrough function
 : Previously, the new output buffer is allocated and it's pushed without any change, so it caused black screen.
   This patch changes the logic when passthrough is true like below.
   - Just assign input buffer as output buffer without new allocation.

[Version] 1.16.2-2
[Profile] Common
[Issue Type] Bug fix

Change-Id: Ida2f2926ea4f2e8374f12acfbc80b587217bebbf
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/gst-plugins-tizen.spec
video360/src/gstvideo360.c

index e2672a8..a2a2436 100644 (file)
@@ -5,7 +5,7 @@
 Name:       gst-plugins-tizen
 Version:    1.16.2
 Summary:    GStreamer tizen plugins (common)
-Release:    1
+Release:    2
 Group:      Multimedia/Framework
 Url:        http://gstreamer.freedesktop.org/
 License:    LGPL-2.1+
index eaed5ab..1c01cb2 100644 (file)
@@ -243,7 +243,7 @@ gst_video360_transform_caps (GstBaseTransform * trans,
     result = tmp;
   }
 
-  GST_DEBUG_OBJECT (trans, "transformed %" GST_PTR_FORMAT " into %"
+  GST_INFO_OBJECT (trans, "transformed %" GST_PTR_FORMAT " into %"
       GST_PTR_FORMAT, caps, result);
 
   return result;
@@ -471,6 +471,8 @@ gst_video360_set_property (GObject * object, guint prop_id,
       break;
     case PROP_PASSTHROUGH:
       this->passthrough = g_value_get_boolean (value);
+      gst_base_transform_set_passthrough ((GstBaseTransform *)object, this->passthrough);
+      GST_INFO_OBJECT (this, "set passthrough %d ", this->passthrough);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -810,8 +812,11 @@ gst_video360_transform_frame (GstVideoFilter *filter,
   GstVideo360 *this = GST_VIDEO360 (filter);
   gboolean ret = FALSE;
 
-  if (this->passthrough)
+  if (this->passthrough) {
+    GST_DEBUG_OBJECT (this, "skip transform");
     return GST_FLOW_OK;
+  }
+
 #ifdef GST_TIZEN_USE_TIMING
   struct timespec start_time, stop_time;
 
@@ -823,15 +828,16 @@ gst_video360_transform_frame (GstVideoFilter *filter,
   GST_BUFFER_DURATION (outframe->buffer) = GST_BUFFER_DURATION (inframe->buffer);
   GST_BUFFER_OFFSET (outframe->buffer) = GST_BUFFER_OFFSET (inframe->buffer);
   GST_BUFFER_OFFSET_END (outframe->buffer) = GST_BUFFER_OFFSET_END (inframe->buffer);
-  gst_buffer_ref (outframe->buffer);
 
   /* Here we do the rendering */
   pthread_mutex_lock (&this->gl_mutex);
   ret = (*this->renderer) (this, inframe, outframe);
   pthread_mutex_unlock (&this->gl_mutex);
 
-  if (!ret)
+  if (!ret) {
+    GST_ERROR_OBJECT (this, "transform failed");
     return GST_FLOW_ERROR;
+  }
 
 #ifdef GST_TIZEN_USE_TIMING
       clock_gettime (CLOCK_THREAD_CPUTIME_ID, &stop_time);
@@ -841,6 +847,9 @@ gst_video360_transform_frame (GstVideoFilter *filter,
       this->frames_nanoseconds += stop_time.tv_nsec - start_time.tv_nsec;
 #endif
 
+  GST_DEBUG_OBJECT (this, "transform done : inbuf %p -> outbuf %p",
+    inframe->buffer, outframe->buffer);
+
   return GST_FLOW_OK;
 }
 
@@ -943,17 +952,28 @@ gst_video360_decide_allocation (GstBaseTransform * trans,
 
 static GstFlowReturn
 gst_video360_prepare_output_buffer (GstBaseTransform * trans,
-    GstBuffer *input, GstBuffer **outbuf)
+    GstBuffer *inbuf, GstBuffer **outbuf)
 {
   GstBuffer *buf = NULL;
   GstVideo360 *this = GST_VIDEO360 (trans);
 
-  if (gst_buffer_pool_acquire_buffer (this->pool, &buf, 0) != GST_FLOW_OK) {
-    GST_ERROR("Failed to prepare output buffer.");
+  if (!outbuf) {
+    GST_ERROR_OBJECT (trans, "NULL outbuf");
     return GST_FLOW_ERROR;
   }
+
+  if (this->passthrough) {
+    buf = inbuf;
+  } else if (gst_buffer_pool_acquire_buffer (this->pool, &buf, 0) != GST_FLOW_OK) {
+    GST_ERROR_OBJECT (trans, "Failed to prepare output buffer.");
+    return GST_FLOW_ERROR;
+  }
+
   *outbuf = buf;
 
+  GST_DEBUG_OBJECT (trans, "passthrough %d, inbuf[%p] outbuf[%p]",
+    this->passthrough, inbuf, *outbuf);
+
   return GST_FLOW_OK;
 }