alphacombine: use the same allocation query data for both decoders

This allows downstream elements to set allocation query parameters for both
decoders, which should be always the same.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1277>
This commit is contained in:
Julian Bouzas 2021-10-29 16:08:20 -04:00
parent b8d6fd905e
commit bc358e5827

View file

@ -511,7 +511,20 @@ gst_alpha_combine_sink_query (GstPad * pad, GstObject * object,
switch (query->type) { switch (query->type) {
case GST_QUERY_ALLOCATION: case GST_QUERY_ALLOCATION:
{ {
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL); int i;
if (!gst_pad_query_default (pad, object, query))
return FALSE;
/* Ensure NULL pool because it cannot be shared between the 2 decoders.
* Ideally, we should cache the downstream query and use it for both
* decoders, but it is hard to know when we should refresh it */
for (i = 0; i < gst_query_get_n_allocation_pools (query); i++) {
guint size = 0, min = 0, max = 0;
gst_query_parse_nth_allocation_pool (query, i, NULL, &size, &min, &max);
gst_query_set_nth_allocation_pool (query, i, NULL, size, min, max);
}
return TRUE; return TRUE;
break; break;
} }
@ -619,6 +632,7 @@ gst_alpha_combine_init (GstAlphaCombine * self)
GST_PAD_SET_PROXY_SCHEDULING (self->src_pad); GST_PAD_SET_PROXY_SCHEDULING (self->src_pad);
GST_PAD_SET_PROXY_ALLOCATION (self->sink_pad); GST_PAD_SET_PROXY_ALLOCATION (self->sink_pad);
GST_PAD_SET_PROXY_ALLOCATION (self->alpha_pad);
gst_pad_set_chain_function (self->sink_pad, gst_alpha_combine_sink_chain); gst_pad_set_chain_function (self->sink_pad, gst_alpha_combine_sink_chain);
gst_pad_set_chain_function (self->alpha_pad, gst_alpha_combine_alpha_chain); gst_pad_set_chain_function (self->alpha_pad, gst_alpha_combine_alpha_chain);