Request minimum buffer even if need_pool is FALSE

When tee is used, it will not request a pool, but still it wants to
know how many buffers are required.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
This commit is contained in:
Nicolas Dufresne 2017-09-05 16:20:44 -04:00 committed by Tim-Philipp Müller
parent a5aff145a2
commit 707385690d
4 changed files with 48 additions and 48 deletions

View file

@ -730,6 +730,7 @@ gst_ca_opengl_layer_sink_propose_allocation (GstBaseSink * bsink, GstQuery * que
GstBufferPool *pool = NULL;
GstStructure *config;
GstCaps *caps;
GstVideoInfo info;
guint size;
gboolean need_pool;
@ -741,15 +742,13 @@ gst_ca_opengl_layer_sink_propose_allocation (GstBaseSink * bsink, GstQuery * que
if (caps == NULL)
goto no_caps;
if (!gst_video_info_from_caps (&info, caps))
goto invalid_caps;
/* the normal size of a frame */
size = info.size;
if (need_pool) {
GstVideoInfo info;
if (!gst_video_info_from_caps (&info, caps))
goto invalid_caps;
/* the normal size of a frame */
size = info.size;
GST_DEBUG_OBJECT (ca_sink, "create new pool");
pool = gst_gl_buffer_pool_new (ca_sink->context);
@ -758,12 +757,13 @@ gst_ca_opengl_layer_sink_propose_allocation (GstBaseSink * bsink, GstQuery * que
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, pool, size, 2, 0);
gst_object_unref (pool);
}
/* we need at least 2 buffer because we hold on to the last one */
gst_query_add_allocation_pool (query, pool, size, 2, 0);
if (pool)
gst_object_unref (pool);
if (ca_sink->context->gl_vtable->FenceSync)
gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);

View file

@ -1844,6 +1844,8 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
GstGLImageSink *glimage_sink = GST_GLIMAGE_SINK (bsink);
GstStructure *config;
GstCaps *caps;
GstBufferPool *pool = NULL;
GstVideoInfo info;
guint size;
gboolean need_pool;
GstStructure *allocation_meta = NULL;
@ -1856,16 +1858,13 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
if (caps == NULL)
goto no_caps;
if (!gst_video_info_from_caps (&info, caps))
goto invalid_caps;
/* the normal size of a frame */
size = info.size;
if (need_pool) {
GstBufferPool *pool;
GstVideoInfo info;
if (!gst_video_info_from_caps (&info, caps))
goto invalid_caps;
/* the normal size of a frame */
size = info.size;
GST_DEBUG_OBJECT (glimage_sink, "create new pool");
pool = gst_gl_buffer_pool_new (glimage_sink->context);
@ -1878,12 +1877,13 @@ gst_glimage_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
g_object_unref (pool);
goto config_failed;
}
/* we need at least 2 buffer because we hold on to the last one */
gst_query_add_allocation_pool (query, pool, size, 2, 0);
g_object_unref (pool);
}
/* we need at least 2 buffer because we hold on to the last one */
gst_query_add_allocation_pool (query, pool, size, 2, 0);
if (pool)
g_object_unref (pool);
if (glimage_sink->context->gl_vtable->FenceSync)
gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);

View file

@ -140,10 +140,10 @@ gst_gl_mixer_propose_allocation (GstAggregator * agg,
GstBufferPool *pool = NULL;
GstStructure *config;
GstCaps *caps;
GstVideoInfo info;
guint size = 0;
gboolean need_pool;
if (!GST_AGGREGATOR_CLASS (gst_gl_mixer_parent_class)->propose_allocation
(agg, agg_pad, decide_query, query))
return FALSE;
@ -155,18 +155,16 @@ gst_gl_mixer_propose_allocation (GstAggregator * agg,
if (caps == NULL)
goto no_caps;
if (!gst_video_info_from_caps (&info, caps))
goto invalid_caps;
/* the normal size of a frame */
size = info.size;
if (need_pool) {
GstVideoInfo info;
if (!gst_video_info_from_caps (&info, caps))
goto invalid_caps;
GST_DEBUG_OBJECT (mix, "create new pool");
pool = gst_gl_buffer_pool_new (context);
/* the normal size of a frame */
size = info.size;
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
@ -174,11 +172,12 @@ gst_gl_mixer_propose_allocation (GstAggregator * agg,
g_object_unref (pool);
goto config_failed;
}
gst_query_add_allocation_pool (query, pool, size, 1, 0);
g_object_unref (pool);
}
gst_query_add_allocation_pool (query, pool, size, 1, 0);
if (pool)
g_object_unref (pool);
/* we also support various metadata */
if (context->gl_vtable->FenceSync)
gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);

View file

@ -774,7 +774,9 @@ gst_gl_filter_propose_allocation (GstBaseTransform * trans,
GstGLFilter *filter = GST_GL_FILTER (trans);
GstGLContext *context = GST_GL_BASE_FILTER (filter)->context;
GstCaps *caps;
GstVideoInfo info;
guint size;
GstBufferPool *pool = NULL;
gboolean need_pool;
gst_query_parse_allocation (query, &caps, &need_pool);
@ -782,16 +784,14 @@ gst_gl_filter_propose_allocation (GstBaseTransform * trans,
if (caps == NULL)
goto no_caps;
if (!gst_video_info_from_caps (&info, caps))
goto invalid_caps;
/* the normal size of a frame */
size = info.size;
if (need_pool) {
GstBufferPool *pool;
GstStructure *config;
GstVideoInfo info;
if (!gst_video_info_from_caps (&info, caps))
goto invalid_caps;
/* the normal size of a frame */
size = info.size;
GST_DEBUG_OBJECT (filter, "create new pool");
pool = gst_gl_buffer_pool_new (context);
@ -803,11 +803,12 @@ gst_gl_filter_propose_allocation (GstBaseTransform * trans,
g_object_unref (pool);
goto config_failed;
}
gst_query_add_allocation_pool (query, pool, size, 1, 0);
g_object_unref (pool);
}
gst_query_add_allocation_pool (query, pool, size, 1, 0);
if (pool)
g_object_unref (pool);
if (context->gl_vtable->FenceSync)
gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);