From ccc410e73c39f4eac34dfce39561e263aa1293ea Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 12 Jun 2015 20:14:37 -0400 Subject: [PATCH] glimagesink: Don't do pool caching We now know that pool caching can cause renegotiation issues when an element in the pipeline change from passthrough to not passthrough. As it's not needed, don't cache existing pools. https://bugzilla.gnome.org/show_bug.cgi?id=748344 --- ext/gl/gstglimagesink.c | 41 ++++++++--------------------------------- ext/gl/gstglimagesink.h | 2 -- 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c index d79494e768..0893dca496 100644 --- a/ext/gl/gstglimagesink.c +++ b/ext/gl/gstglimagesink.c @@ -488,7 +488,6 @@ gst_glimage_sink_init (GstGLImageSink * glimage_sink) glimage_sink->keep_aspect_ratio = TRUE; glimage_sink->par_n = 0; glimage_sink->par_d = 1; - glimage_sink->pool = NULL; glimage_sink->stored_buffer = NULL; glimage_sink->redisplay_texture = 0; glimage_sink->handle_events = TRUE; @@ -877,12 +876,6 @@ gst_glimage_sink_change_state (GstElement * element, GstStateChange transition) glimage_sink->caps = NULL; } - /* we're losing the context, this pool is no use anymore */ - if (glimage_sink->pool) { - gst_object_unref (glimage_sink->pool); - glimage_sink->pool = NULL; - } - if (glimage_sink->context) { GstGLWindow *window = gst_gl_context_get_window (glimage_sink->context); @@ -1263,6 +1256,7 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) goto no_caps; if (need_pool) { + GstBufferPool *pool; GstVideoInfo info; if (!gst_video_info_from_caps (&info, caps)) @@ -1271,36 +1265,17 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query) /* the normal size of a frame */ size = info.size; - if (glimage_sink->pool) { - GstCaps *pcaps; + GST_DEBUG_OBJECT (glimage_sink, "create new pool"); - /* we had a pool, check caps */ - GST_DEBUG_OBJECT (glimage_sink, "check existing pool caps"); - config = gst_buffer_pool_get_config (glimage_sink->pool); - gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL); + pool = gst_gl_buffer_pool_new (glimage_sink->context); + config = gst_buffer_pool_get_config (pool); + gst_buffer_pool_config_set_params (config, caps, size, 0, 0); - if (!gst_caps_is_equal (caps, pcaps)) { - GST_DEBUG_OBJECT (glimage_sink, "pool has different caps"); - /* different caps, we can't use this pool */ - gst_object_unref (glimage_sink->pool); - glimage_sink->pool = NULL; - } - gst_structure_free (config); - } - - if (glimage_sink->pool == NULL) { - GST_DEBUG_OBJECT (glimage_sink, "create new pool"); - - glimage_sink->pool = gst_gl_buffer_pool_new (glimage_sink->context); - config = gst_buffer_pool_get_config (glimage_sink->pool); - gst_buffer_pool_config_set_params (config, caps, size, 0, 0); - - if (!gst_buffer_pool_set_config (glimage_sink->pool, config)) - goto config_failed; - } + if (!gst_buffer_pool_set_config (pool, config)) + goto config_failed; /* we need at least 2 buffer because we hold on to the last one */ - gst_query_add_allocation_pool (query, glimage_sink->pool, size, 2, 0); + gst_query_add_allocation_pool (query, pool, size, 2, 0); } if (glimage_sink->context->gl_vtable->FenceSync) diff --git a/ext/gl/gstglimagesink.h b/ext/gl/gstglimagesink.h index 03e81365c5..b8c256ba11 100644 --- a/ext/gl/gstglimagesink.h +++ b/ext/gl/gstglimagesink.h @@ -80,8 +80,6 @@ struct _GstGLImageSink gboolean keep_aspect_ratio; gint par_n, par_d; - GstBufferPool *pool; - /* avoid replacing the stored_buffer while drawing */ GMutex drawing_lock; GstBuffer *stored_buffer;