From 880ec37912ccbd870e5909f0752e6af9cedc6b0a Mon Sep 17 00:00:00 2001 From: Hyunil Date: Wed, 9 Sep 2015 20:41:25 +0900 Subject: [PATCH] Waylandsink : fix the null pointer input to g_hash_table_remove Change-Id: I6ac3d81275cfee923db0475c87e41021551dfb0e Signed-off-by: Hyunil --- ext/wayland/waylandpool.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/ext/wayland/waylandpool.c b/ext/wayland/waylandpool.c index 67dfca2..ee6457c 100755 --- a/ext/wayland/waylandpool.c +++ b/ext/wayland/waylandpool.c @@ -179,16 +179,17 @@ buffer_release (void *data, struct wl_buffer *wl_buffer) GstWlMeta *meta; g_mutex_lock (&self->buffers_map_mutex); +#ifdef GST_WLSINK_ENHANCEMENT + buffer = g_hash_table_lookup (self->buffers_map, wl_buffer); + if (buffer) { + meta = gst_buffer_get_wl_meta (buffer); + } /*remove displaying buffer */ gst_wayland_buffer_pool_remove_displaying_buffer (self, meta, wl_buffer); - buffer = g_hash_table_lookup (self->buffers_map, wl_buffer); - GST_LOG_OBJECT (self, "wl_buffer::release (GstBuffer: %p)", buffer); - - if (buffer) { - meta = gst_buffer_get_wl_meta (buffer); + if (meta) { if (meta->used_by_compositor) { meta->used_by_compositor = FALSE; /* unlock before unref because stop() may be called from here */ @@ -196,6 +197,19 @@ buffer_release (void *data, struct wl_buffer *wl_buffer) gst_buffer_unref (buffer); } } + #else + GST_LOG_OBJECT (self, "wl_buffer::release (GstBuffer: %p)", buffer); + + if (buffer) { + meta = gst_buffer_get_wl_meta (buffer); + if (meta->used_by_compositor) { + meta->used_by_compositor = FALSE; + /* unlock before unref because stop() may be called from here */ + GST_LOG_OBJECT (self, "Decrease ref count of buffer"); + gst_buffer_unref (buffer); + } + } + #endif g_mutex_unlock (&self->buffers_map_mutex); } -- 2.7.4