From 09e298fe4282ce4bd1843ae116d7568df08ec16e Mon Sep 17 00:00:00 2001 From: Hyunil Park Date: Tue, 14 Jul 2015 13:42:51 +0900 Subject: [PATCH] Waylandsink : 1. change video format name for SN12 and ST12 2. gst_wayland_compositor_release_all_buffers function is used for Normal Video format only. Change-Id: I50486eaf1f474ea92a9c324515bc4c1c58b56a67 Signed-off-by: Hyunil Park --- ext/wayland/gstwaylandsink.c | 23 +++++++++++++++-------- ext/wayland/waylandpool.c | 8 ++++---- ext/wayland/wldisplay.c | 2 +- ext/wayland/wldisplay.h | 2 +- packaging/gst-plugins-bad.spec | 2 +- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c index b0d98ef..7afde44 100755 --- a/ext/wayland/gstwaylandsink.c +++ b/ext/wayland/gstwaylandsink.c @@ -226,10 +226,14 @@ gst_wayland_sink_finalize (GObject * object) gst_buffer_unref (sink->last_buffer); if (sink->display) { /* see comment about this call in gst_wayland_sink_change_state() */ - if (sink->pool) { +#ifdef GST_WLSINK_ENHANCEMENT + if (sink->pool && !sink->display->is_native_format) +#else + if (sink->pool) +#endif gst_wayland_compositor_release_all_buffers (GST_WAYLAND_BUFFER_POOL (sink->pool)); - } + g_object_unref (sink->display); } if (sink->window) @@ -391,10 +395,13 @@ gst_wayland_sink_change_state (GstElement * element, GstStateChange transition) * unref the pool and therefore the display, which will try to * stop the thread from within itself and cause a deadlock. */ - if (sink->pool) { +#ifdef GST_WLSINK_ENHANCEMENT + if (sink->pool && !sink->display->is_native_format) +#else + if (sink->pool) +#endif gst_wayland_compositor_release_all_buffers (GST_WAYLAND_BUFFER_POOL (sink->pool)); - } g_clear_object (&sink->display); g_clear_object (&sink->pool); } @@ -530,9 +537,9 @@ gst_wayland_sink_set_caps (GstBaseSink * bsink, GstCaps * caps) #ifdef GST_WLSINK_ENHANCEMENT if (GST_VIDEO_INFO_FORMAT (&info) == GST_VIDEO_FORMAT_SN12 || GST_VIDEO_INFO_FORMAT (&info) == GST_VIDEO_FORMAT_ST12) { - sink->display->is_special_format = TRUE; + sink->display->is_native_format = TRUE; } else { - sink->display->is_special_format = FALSE; + sink->display->is_native_format = FALSE; /* create a new pool for the new configuration */ newpool = gst_wayland_buffer_pool_new (sink->display); @@ -610,7 +617,7 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) guint size; gboolean need_pool; - if (sink->display->is_special_format == TRUE) + if (sink->display->is_native_format == TRUE) return TRUE; gst_query_parse_allocation (query, &caps, &need_pool); @@ -811,7 +818,7 @@ gst_wayland_sink_render (GstBaseSink * bsink, GstBuffer * buffer) GST_LOG_OBJECT (sink, "buffer %p not from our pool, copying", buffer); #ifdef GST_WLSINK_ENHANCEMENT - if (sink->display->is_special_format == TRUE) { + if (sink->display->is_native_format == TRUE) { /*in case of SN12 or ST12 video format */ GstMemory *mem; GstMapInfo mem_info = GST_MAP_INFO_INIT; diff --git a/ext/wayland/waylandpool.c b/ext/wayland/waylandpool.c index 76496a6..bf7aaaf 100755 --- a/ext/wayland/waylandpool.c +++ b/ext/wayland/waylandpool.c @@ -35,7 +35,7 @@ #include #include #ifdef GST_WLSINK_ENHANCEMENT -#define DUMP_BUFFER +//#define DUMP_BUFFER #ifdef DUMP_BUFFER int dump_cnt = 0; int _write_rawdata (const char *file, const void *data, unsigned int size); @@ -99,7 +99,6 @@ static gboolean gst_wayland_tizen_buffer_pool_start (GstBufferPool * pool); static gboolean gst_wayland_tizen_buffer_pool_stop (GstBufferPool * pool); static GstFlowReturn gst_wayland_tizen_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, GstBufferPoolAcquireParams * params); -static void tizen_buffer_release (void *data, struct wl_buffer *wl_buffer); #endif #define gst_wayland_buffer_pool_parent_class parent_class @@ -176,6 +175,7 @@ buffer_release (void *data, struct wl_buffer *wl_buffer) meta->used_by_compositor = FALSE; /* unlock before unref because stop() may be called from here */ g_mutex_unlock (&self->buffers_map_mutex); + GST_ERROR("gst_buffer_unref"); gst_buffer_unref (buffer); return; } @@ -453,7 +453,7 @@ gst_wayland_tizen_buffer_pool_start (GstBufferPool * pool) tbm_bo_handle vitual_addr; guint size = 0; - if (self->display->is_special_format == TRUE) { + if (self->display->is_native_format == TRUE) { /*in case of SN12 or ST12 video format */ size = self->display->native_video_size * 15; vitual_addr.ptr = NULL; @@ -530,7 +530,7 @@ gst_wayland_tizen_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, GstWlMeta *meta; tbm_bo_handle vitual_addr; - if (self->display->is_special_format == TRUE) { + if (self->display->is_native_format == TRUE) { /*in case of SN12 or ST12 video format */ unsigned int name[NV_BUF_PLANE_NUM]; unsigned int offset[NV_BUF_PLANE_NUM] = { 0, }; diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c index 35b1f0a..e87dbd1 100755 --- a/ext/wayland/wldisplay.c +++ b/ext/wayland/wldisplay.c @@ -151,7 +151,7 @@ gst_wl_display_finalize (GObject * gobject) g_thread_join (self->thread); #ifdef GST_WLSINK_ENHANCEMENT - if (self->is_special_format == FALSE) { /*need to remove */ + if (self->is_native_format == FALSE) { /*in case of normal video format */ if (self->tbm_bo) tbm_bo_unref (self->tbm_bo); diff --git a/ext/wayland/wldisplay.h b/ext/wayland/wldisplay.h index 72625cd..a4dc6a1 100755 --- a/ext/wayland/wldisplay.h +++ b/ext/wayland/wldisplay.h @@ -81,7 +81,7 @@ struct _GstWlDisplay tbm_bufmgr tbm_bufmgr; tbm_bo tbm_bo; - gboolean is_special_format; /*SN12, ST12 */ + gboolean is_native_format; /*SN12, ST12 */ void *bo[NV_BUF_PLANE_NUM]; int plane_size[NV_BUF_PLANE_NUM]; int stride_width[NV_BUF_PLANE_NUM]; diff --git a/packaging/gst-plugins-bad.spec b/packaging/gst-plugins-bad.spec index 7b38890..1ebc42a 100644 --- a/packaging/gst-plugins-bad.spec +++ b/packaging/gst-plugins-bad.spec @@ -4,7 +4,7 @@ Name: gst-plugins-bad Version: 1.4.1 -Release: 4 +Release: 5 Summary: GStreamer Streaming-Media Framework Plug-Ins License: GPL-2.0+ and LGPL-2.1+ Group: Multimedia/Framework -- 2.7.4