dwritebaseoverlay: Forward downstream wanted min buffer size

Upstream element might want to know the min buffer size,
d3d11 decoders for example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4929>
This commit is contained in:
Seungha Yang 2023-06-27 22:15:12 +09:00 committed by GStreamer Marge Bot
parent 8838a670e0
commit 43ee082189

View file

@ -159,6 +159,7 @@ struct _GstDWriteBaseOverlayPrivate
GstDWriteBaseOverlayBlendMode::UNKNOWN;
gboolean attach_meta = FALSE;
gboolean is_d3d11 = FALSE;
guint downstream_min_buffers = 0;
GstBufferPool *bitmap_pool = nullptr;
GstBufferPool *text_pool = nullptr;
@ -942,6 +943,9 @@ gst_dwrite_base_overlay_decide_allocation (GstBaseTransform * trans,
else
gst_query_add_allocation_pool (query, pool, size, min, max);
GST_DEBUG_OBJECT (self, "Downstream min buffer: %d", min);
priv->downstream_min_buffers = min;
gst_object_unref (pool);
return GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans,
@ -1025,8 +1029,6 @@ gst_dwrite_base_overlay_propose_allocation (GstBaseTransform * trans,
}
size = info.size;
gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
if (is_d3d11) {
GstD3D11AllocationParams *params;
guint bind_flags = 0;
@ -1057,7 +1059,8 @@ gst_dwrite_base_overlay_propose_allocation (GstBaseTransform * trans,
gst_d3d11_allocation_params_free (params);
}
gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
gst_buffer_pool_config_set_params (config,
caps, size, priv->downstream_min_buffers, 0);
if (!gst_buffer_pool_set_config (pool, config)) {
GST_ERROR_OBJECT (self, "Couldn't set config");
@ -1073,7 +1076,8 @@ gst_dwrite_base_overlay_propose_allocation (GstBaseTransform * trans,
gst_structure_free (config);
}
gst_query_add_allocation_pool (query, pool, size, 0, 0);
gst_query_add_allocation_pool (query,
pool, size, priv->downstream_min_buffers, 0);
gst_object_unref (pool);
}