mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-29 18:48:44 +00:00
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:
parent
e796a7cb97
commit
9b2e28d91d
12 changed files with 123 additions and 106 deletions
|
@ -2273,6 +2273,12 @@ gst_dfbvideosink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
|
||||
gst_query_parse_allocation (query, &caps, &need_pool);
|
||||
|
||||
if (!caps) {
|
||||
GST_WARNING_OBJECT (dfbvideosink, "Missing caps in allocation query.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* FIXME re-using buffer pool breaks renegotiation */
|
||||
if ((pool = dfbvideosink->pool))
|
||||
gst_object_ref (pool);
|
||||
|
||||
|
@ -2293,6 +2299,16 @@ gst_dfbvideosink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
return FALSE;
|
||||
}
|
||||
gst_structure_free (config);
|
||||
} else {
|
||||
GstVideoInfo info;
|
||||
|
||||
if (!gst_video_info_from_caps (caps)) {
|
||||
GST_WARNING_OBJECT (dfbvideosink,
|
||||
"Invalid video caps in allocation query");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
size = info.size;
|
||||
}
|
||||
|
||||
gst_query_add_allocation_pool (query, pool, size, 1, 0);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -202,6 +202,7 @@ gst_gtk_gl_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
GstBufferPool *pool = NULL;
|
||||
GstStructure *config;
|
||||
GstCaps *caps;
|
||||
GstVideoInfo info;
|
||||
guint size;
|
||||
gboolean need_pool;
|
||||
GstStructure *allocation_meta = NULL;
|
||||
|
@ -215,18 +216,16 @@ gst_gtk_gl_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) {
|
||||
GstVideoInfo info;
|
||||
|
||||
if (!gst_video_info_from_caps (&info, caps))
|
||||
goto invalid_caps;
|
||||
|
||||
GST_DEBUG_OBJECT (gtk_sink, "create new pool");
|
||||
pool = gst_gl_buffer_pool_new (gtk_sink->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);
|
||||
gst_buffer_pool_config_add_option (config,
|
||||
|
@ -234,12 +233,13 @@ gst_gtk_gl_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
|
||||
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);
|
||||
|
||||
GST_OBJECT_LOCK (gtk_sink);
|
||||
display_width = gtk_sink->display_width;
|
||||
display_height = gtk_sink->display_height;
|
||||
|
|
|
@ -421,6 +421,7 @@ gst_qt_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
if (caps == NULL)
|
||||
goto no_caps;
|
||||
|
||||
/* FIXME re-using buffer pool breaks renegotiation */
|
||||
if ((pool = qt_sink->pool))
|
||||
gst_object_ref (pool);
|
||||
|
||||
|
@ -439,30 +440,31 @@ gst_qt_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
pool = NULL;
|
||||
}
|
||||
gst_structure_free (config);
|
||||
}
|
||||
|
||||
if (pool == NULL && need_pool) {
|
||||
} else {
|
||||
GstVideoInfo info;
|
||||
|
||||
if (!gst_video_info_from_caps (&info, caps))
|
||||
goto invalid_caps;
|
||||
|
||||
GST_DEBUG_OBJECT (qt_sink, "create new pool");
|
||||
pool = gst_gl_buffer_pool_new (qt_sink->context);
|
||||
|
||||
/* the normal size of a frame */
|
||||
size = info.size;
|
||||
}
|
||||
|
||||
if (pool == NULL && need_pool) {
|
||||
|
||||
GST_DEBUG_OBJECT (qt_sink, "create new pool");
|
||||
pool = gst_gl_buffer_pool_new (qt_sink->context);
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
|
||||
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 */
|
||||
if (pool) {
|
||||
gst_query_add_allocation_pool (query, pool, size, 2, 0);
|
||||
gst_query_add_allocation_pool (query, pool, size, 2, 0);
|
||||
if (pool)
|
||||
gst_object_unref (pool);
|
||||
}
|
||||
|
||||
/* we also support various metadata */
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
|
||||
|
|
|
@ -109,23 +109,23 @@ _buffer_propose_allocation (gpointer impl, GstQuery * decide_query,
|
|||
struct BufferUpload *raw = impl;
|
||||
gboolean need_pool;
|
||||
GstCaps *caps;
|
||||
GstVideoInfo info;
|
||||
guint size;
|
||||
GstBufferPool *pool = NULL;
|
||||
|
||||
gst_query_parse_allocation (query, &caps, &need_pool);
|
||||
|
||||
if (caps == NULL)
|
||||
return;
|
||||
|
||||
if (!gst_video_info_from_caps (&info, caps))
|
||||
return;
|
||||
|
||||
/* 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))
|
||||
return;
|
||||
|
||||
/* the normal size of a frame */
|
||||
size = info.size;
|
||||
|
||||
pool = gst_vulkan_buffer_pool_new (raw->upload->device);
|
||||
|
||||
|
@ -136,11 +136,12 @@ _buffer_propose_allocation (gpointer impl, GstQuery * decide_query,
|
|||
g_object_unref (pool);
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -536,10 +536,9 @@ gst_wayland_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
if (need_pool)
|
||||
pool = gst_wayland_create_pool (sink, caps);
|
||||
|
||||
if (pool) {
|
||||
gst_query_add_allocation_pool (query, pool, sink->video_info.size, 2, 0);
|
||||
gst_query_add_allocation_pool (query, pool, sink->video_info.size, 2, 0);
|
||||
if (pool)
|
||||
g_object_unref (pool);
|
||||
}
|
||||
|
||||
gst_query_add_allocation_param (query, gst_wl_shm_allocator_get (), NULL);
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -782,6 +782,7 @@ gst_av_sample_video_sink_propose_allocation (GstBaseSink * bsink, GstQuery * que
|
|||
if (caps == NULL)
|
||||
goto no_caps;
|
||||
|
||||
/* FIXME re-using buffer pool breaks renegotiation */
|
||||
if ((pool = av_sink->pool))
|
||||
gst_object_ref (pool);
|
||||
|
||||
|
@ -800,19 +801,19 @@ gst_av_sample_video_sink_propose_allocation (GstBaseSink * bsink, GstQuery * que
|
|||
pool = NULL;
|
||||
}
|
||||
gst_structure_free (config);
|
||||
}
|
||||
|
||||
if (pool == NULL && need_pool) {
|
||||
} else {
|
||||
GstVideoInfo info;
|
||||
|
||||
if (!gst_video_info_from_caps (&info, caps))
|
||||
goto invalid_caps;
|
||||
|
||||
GST_DEBUG_OBJECT (av_sink, "create new pool");
|
||||
pool = gst_video_buffer_pool_new ();
|
||||
|
||||
/* the normal size of a frame */
|
||||
size = info.size;
|
||||
}
|
||||
|
||||
if (pool == NULL && need_pool) {
|
||||
GST_DEBUG_OBJECT (av_sink, "create new pool");
|
||||
pool = gst_video_buffer_pool_new ();
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
|
||||
|
@ -820,10 +821,9 @@ gst_av_sample_video_sink_propose_allocation (GstBaseSink * bsink, GstQuery * que
|
|||
goto config_failed;
|
||||
}
|
||||
/* we need at least 2 buffer because we hold on to the last one */
|
||||
if (pool) {
|
||||
gst_query_add_allocation_pool (query, pool, size, 2, 0);
|
||||
gst_query_add_allocation_pool (query, pool, size, 2, 0);
|
||||
if (pool)
|
||||
gst_object_unref (pool);
|
||||
}
|
||||
|
||||
/* we also support various metadata */
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
|
||||
|
|
|
@ -470,6 +470,7 @@ gst_d3dvideosink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
return TRUE;
|
||||
#endif
|
||||
|
||||
/* FIXME re-using buffer pool breaks renegotiation */
|
||||
GST_OBJECT_LOCK (sink);
|
||||
pool = sink->pool ? gst_object_ref (sink->pool) : NULL;
|
||||
GST_OBJECT_UNLOCK (sink);
|
||||
|
@ -489,9 +490,7 @@ gst_d3dvideosink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
pool = NULL;
|
||||
}
|
||||
gst_structure_free (config);
|
||||
}
|
||||
|
||||
if (pool == NULL && need_pool) {
|
||||
} else {
|
||||
GstVideoInfo info;
|
||||
|
||||
if (!gst_video_info_from_caps (&info, caps)) {
|
||||
|
@ -500,11 +499,13 @@ gst_d3dvideosink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (sink, "create new pool");
|
||||
pool = gst_d3dsurface_buffer_pool_new (sink);
|
||||
|
||||
/* the normal size of a frame */
|
||||
size = info.size;
|
||||
}
|
||||
|
||||
if (pool == NULL && need_pool) {
|
||||
GST_DEBUG_OBJECT (sink, "create new pool");
|
||||
pool = gst_d3dsurface_buffer_pool_new (sink);
|
||||
|
||||
config = gst_buffer_pool_get_config (pool);
|
||||
/* we need at least 2 buffer because we hold on to the last one */
|
||||
|
@ -516,11 +517,10 @@ gst_d3dvideosink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
}
|
||||
}
|
||||
|
||||
if (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);
|
||||
/* 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);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -982,11 +982,10 @@ gst_kms_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
|
|||
goto no_pool;
|
||||
}
|
||||
|
||||
if (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);
|
||||
/* 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);
|
||||
}
|
||||
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL);
|
||||
gst_query_add_allocation_meta (query, GST_VIDEO_CROP_META_API_TYPE, NULL);
|
||||
|
|
Loading…
Reference in a new issue