* unref the pool and therefore the display, which will try to
* stop the thread from within itself and cause a deadlock.
*/
-#ifdef GST_WLSINK_ENHANCEMENT
- if (sink->pool && !sink->display->is_native_format)
-#else
- if (sink->pool)
-#endif
+ if (sink->pool) {
gst_wayland_compositor_release_all_buffers (GST_WAYLAND_BUFFER_POOL
(sink->pool));
+ }
g_clear_object (&sink->display);
g_clear_object (&sink->pool);
}
if (ret != GST_FLOW_OK)
goto no_buffer;
-
-
} else {
/*in case of normal video format and pool is not our pool */
gst_buffer_replace (&sink->last_buffer, to_render);
render_last_buffer (sink);
- if (buffer != to_render)
+ if (buffer != to_render) {
+ GST_LOG_OBJECT (sink, "Decrease ref count of buffer");
gst_buffer_unref (to_render);
+ }
goto done;
no_window_size:
static void
gst_wl_meta_free (GstWlMeta * meta, GstBuffer * buffer)
{
+#ifdef GST_WLSINK_ENHANCEMENT
+ if (!meta || !meta->pool)
+ return;
+ g_hash_table_remove (meta->pool->buffers_map, meta->wbuffer);
+#endif
GST_DEBUG ("destroying wl_buffer %p", meta->wbuffer);
wl_buffer_destroy (meta->wbuffer);
}
#ifdef GST_WLSINK_ENHANCEMENT
gobject_class->finalize = gst_wayland_tizen_buffer_pool_finalize;
gstbufferpool_class->start = gst_wayland_tizen_buffer_pool_start;
- gstbufferpool_class->stop = gst_wayland_tizen_buffer_pool_stop;
gstbufferpool_class->alloc_buffer = gst_wayland_tizen_buffer_pool_alloc;
#else
gobject_class->finalize = gst_wayland_buffer_pool_finalize;
if (meta->used_by_compositor) {
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_LOG_OBJECT (self, "Decrease ref count of buffer");
gst_buffer_unref (buffer);
+ g_mutex_unlock (&self->buffers_map_mutex);
return;
}
}
g_return_if_fail (meta->used_by_compositor == FALSE);
meta->used_by_compositor = TRUE;
+ GST_LOG_OBJECT(self, "Increase ref count of buffer");
gst_buffer_ref (buffer);
}
GstWlMeta *meta = gst_buffer_get_wl_meta (buffer);
GList **to_unref = data;
- g_return_if_fail (meta != NULL);
+ if (meta == NULL)
+ return;
if (meta->used_by_compositor) {
meta->used_by_compositor = FALSE;
g_mutex_lock (&self->buffers_map_mutex);
g_hash_table_foreach (self->buffers_map, unref_used_buffers, &to_unref);
- g_mutex_unlock (&self->buffers_map_mutex);
- /* unref without the lock because stop() may be called from here */
if (to_unref) {
g_list_free_full (to_unref, (GDestroyNotify) gst_buffer_unref);
}
+ g_mutex_unlock (&self->buffers_map_mutex);
}
static gboolean
self->size = 0;
self->used = 0;
+ tizen_buffer_pool_destroy (self->display->tizen_buffer_pool);
+ self->display->tizen_buffer_pool = NULL;
+
/* all buffers are about to be destroyed;
* we should no longer do anything with them */
g_mutex_lock (&self->buffers_map_mutex);