Waylandsink : Add checking MMVideoBuffer for GstBuffer of Codec Bufferpool 95/156395/2
authorHyunil <hyunil46.park@samsung.com>
Wed, 18 Oct 2017 08:05:01 +0000 (17:05 +0900)
committerHyunil <hyunil46.park@samsung.com>
Wed, 18 Oct 2017 10:40:42 +0000 (19:40 +0900)
Change-Id: Iafcbcd827682a4000a0f7283454ecdee1f94d142
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
ext/wayland/gstwaylandsink.c

index 41da309..35c5069 100755 (executable)
@@ -2046,13 +2046,15 @@ gst_wayland_sink_has_wlbuffer (GstWaylandSink * sink, GstBuffer * buffer)
   return FALSE;
 }
 
-static void
+static GstFlowReturn
 gst_wayland_sink_no_create_wlbuffer (GstWaylandSink * sink, GstBuffer * buffer)
 {
   GstMemory *mem;
+  MMVideoBuffer *mm_video_buf = NULL;
+  GstFlowReturn ret = GST_FLOW_OK;
   FUNCTION;
-  g_return_if_fail (sink != NULL);
-  g_return_if_fail (buffer != NULL);
+  g_return_val_if_fail (sink != NULL, GST_FLOW_ERROR);
+  g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
 
   /* the last_buffer for flushing has wlbuffer or
      buffer is created by previous plugins or waylandsink has wlbuffer */
@@ -2065,6 +2067,15 @@ gst_wayland_sink_no_create_wlbuffer (GstWaylandSink * sink, GstBuffer * buffer)
         ("buffer(%p) is created by previous plugins with BufferPool has a wl_buffer, "
         "writing directly", buffer);
     GST_LOG ("previous plugins must manage buffer index well");
+    /* check MMVideoBuffer */
+    mm_video_buf = gst_wayland_sink_get_mm_video_buf (buffer);
+    if (mm_video_buf != NULL) {
+      GST_LOG ("GstBuffer(%p) has MMVideoBuffer(%p)", buffer, mm_video_buf);
+    } else {
+      GST_ERROR ("GstBuffer(%p) has not MMVideoBuffer(%p)", buffer,
+          mm_video_buf);
+      return GST_FLOW_ERROR;
+    }
   }
 
   sink->to_render = buffer;
@@ -2072,6 +2083,8 @@ gst_wayland_sink_no_create_wlbuffer (GstWaylandSink * sink, GstBuffer * buffer)
   if (sink->dump_video && !sink->display->is_native_format)
     gst_wayland_sink_dump_raw_video (sink, sink->to_render,
         sink->display->dump_count++, sink->total_dump);
+
+  return ret;
 }
 
 static void
@@ -2203,7 +2216,7 @@ gst_wayland_sink_create_wlbuffer (GstWaylandSink * sink, GstBuffer * buffer)
   sink->to_render = NULL;
 
   if (gst_wayland_sink_has_wlbuffer (sink, buffer)) {
-    gst_wayland_sink_no_create_wlbuffer (sink, buffer);
+    ret = gst_wayland_sink_no_create_wlbuffer (sink, buffer);
   } else {
     mem = gst_buffer_peek_memory (buffer, 0);
     if (gst_is_wl_memory (mem)) {