From fe03855a0099cee459e352bd129308012788a59b Mon Sep 17 00:00:00 2001 From: Hyunil Date: Wed, 18 Oct 2017 17:05:01 +0900 Subject: [PATCH] Waylandsink : Add checking MMVideoBuffer for GstBuffer of Codec Bufferpool Change-Id: Iafcbcd827682a4000a0f7283454ecdee1f94d142 Signed-off-by: Hyunil --- ext/wayland/gstwaylandsink.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c index 41da309..35c5069 100755 --- a/ext/wayland/gstwaylandsink.c +++ b/ext/wayland/gstwaylandsink.c @@ -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)) { -- 2.7.4