From 213d42a88edf1f1f9fcc6731ff8416b8926b9bf7 Mon Sep 17 00:00:00 2001 From: Hyunil Date: Wed, 19 Oct 2016 19:34:22 +0900 Subject: [PATCH] waylandsink : Add new flag to fix bug about flush buffer Change-Id: Id0f592c0b8212bf27732c40dac4400ba61d398d9 Signed-off-by: Hyunil --- ext/wayland/gstwaylandsink.c | 18 +++++++++++------- ext/wayland/gstwaylandsink.h | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c index 90ba883..99d8b67 100755 --- a/ext/wayland/gstwaylandsink.c +++ b/ext/wayland/gstwaylandsink.c @@ -477,6 +477,7 @@ gst_wayland_sink_init (GstWaylandSink * sink) FUNCTION; #ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT sink->signal_handoffs = FALSE; + sink->request_camera_flush_buf = FALSE; sink->keep_camera_preview = FALSE; sink->got_costum_event = FALSE; sink->USE_TBM = TRUE; @@ -526,7 +527,7 @@ gst_wayland_sink_need_to_make_flush_buffer (GstWaylandSink * sink) g_return_val_if_fail (sink->display != NULL, FALSE); if ((gst_wayland_sink_check_use_gapless (sink)) - || sink->keep_camera_preview || sink->display->flush_request) { + || sink->request_camera_flush_buf || sink->display->flush_request) { sink->display->flush_request = TRUE; return TRUE; } @@ -730,6 +731,7 @@ gst_wayland_sink_get_mm_video_buf_info (GstWaylandSink * sink, GST_DEBUG ("TBM bo %p %p", mm_video_buf->handle.bo[0], mm_video_buf->handle.bo[1]); display->native_video_size = 0; + display->flush_request = 0; display->flush_request = mm_video_buf->flush_request; GST_DEBUG ("flush_request value is %d", display->flush_request); #ifdef USE_WL_FLUSH_BUFFER @@ -1295,7 +1297,9 @@ gst_wayland_sink_change_state (GstElement * element, GstStateChange transition) if (sink->window) { if (!gst_wl_window_is_toplevel (sink->window)) { GstBaseSink *bsink = GST_BASE_SINK (element); + sink->request_camera_flush_buf = TRUE; gst_wayland_sink_keep_camera_preview (bsink); + sink->request_camera_flush_buf = FALSE; break; } } @@ -1830,7 +1834,7 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer) && !gst_wayland_sink_check_use_gapless (sink)) goto done; -#ifndef TIZEN_FEATURE_WLSINK_ENHANCEMENT /* for tizen view_port, we don't know window size */ +#ifndef TIZEN_FEATURE_WLSINK_ENHANCEMENT /* for tizen view_port, we don't know window size */ /* make sure that the application has called set_render_rectangle() */ if (G_UNLIKELY (sink->window->render_rectangle.w == 0)) goto no_window_size; @@ -1840,7 +1844,7 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer) wlbuffer = gst_buffer_get_wl_buffer (buffer); if (G_LIKELY (wlbuffer && wlbuffer->display == sink->display) && !(gst_wayland_sink_check_use_gapless (sink)) - && !sink->keep_camera_preview) { + && !sink->request_camera_flush_buf) { GST_LOG_OBJECT (sink, "buffer %p has a wl_buffer from our display, " "writing directly", buffer); //buffer is from our pool and have wl_buffer GST_LOG ("wl_buffer (%p)", wlbuffer->wlbuffer); to_render = buffer; @@ -1897,7 +1901,7 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer) /* last_buffer from gaplasee have wlbuffer */ if (G_UNLIKELY (!wlbuffer) || (gst_wayland_sink_check_use_gapless (sink)) - || sink->keep_camera_preview) { + || sink->request_camera_flush_buf) { wbuf = gst_wl_shm_memory_construct_wl_buffer (mem, sink->display, &sink->video_info); @@ -1972,7 +1976,7 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer) if ((G_UNLIKELY (buffer == sink->last_buffer) && !(gst_wayland_sink_check_use_gapless (sink))) || (G_UNLIKELY (buffer == sink->last_buffer) - && !sink->keep_camera_preview)) { + && !sink->request_camera_flush_buf)) { GST_LOG_OBJECT (sink, "Buffer already being rendered"); goto done; } @@ -2133,7 +2137,7 @@ gst_wayland_sink_videooverlay_init (GstVideoOverlayInterface * iface) iface->set_window_handle = gst_wayland_sink_set_window_handle; iface->set_render_rectangle = gst_wayland_sink_set_render_rectangle; iface->expose = gst_wayland_sink_expose; -#ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT /* use unique_id */ +#ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT /* use unique_id */ iface->set_wl_window_wl_surface_id = gst_wayland_sink_set_wl_window_wl_surface_id; #endif @@ -2185,7 +2189,7 @@ gst_wayland_sink_set_window_handle (GstVideoOverlay * overlay, guintptr handle) g_return_if_fail (sink != NULL); -#ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT /* use unique_id */ +#ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT /* use unique_id */ if (sink->window != NULL) { GST_WARNING_OBJECT (sink, "changing window handle is not supported"); return; diff --git a/ext/wayland/gstwaylandsink.h b/ext/wayland/gstwaylandsink.h index a2c56d9..03e45f8 100644 --- a/ext/wayland/gstwaylandsink.h +++ b/ext/wayland/gstwaylandsink.h @@ -100,7 +100,7 @@ struct _GstWaylandSink #ifdef TIZEN_FEATURE_WLSINK_ENHANCEMENT gboolean signal_handoffs; - + gboolean request_camera_flush_buf; gboolean keep_camera_preview; gboolean got_costum_event; gboolean visible; -- 2.7.4