ALLOCATION_QUERY via tee

Hi there,

I’m looking some example how to handle allocation query in the pipelines with tee.
My pipeline looks like this:

fakesrc ! elem_a ! tee name=tee_1 ! elem_b ! fakesink tee_1. ! elem_c ! fakesink

I want to send allocation query from elem_a to elem_b and elem_c respectively, then handle them in _b and _c (add some metadata to them) and
then obtain metadata in _a. My current implementation (took an example from here: Memory allocation ) works perfectly fine with 1-1 connection but failing once I’m adding the second branch.

In short, the current implementation looks like:

elem_a:

[gst_elem_a_state_change]
query = gst_query_new_allocation (caps, TRUE);
if (gst_pad_peer_query (elem_a->srcpad, query) {
  if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, &video_idx)) {
    gst_query_parse_nth_allocation_meta (query, video_idx, &params);
    ...
  }
}


elem_b/elem_c:
if (GST_QUERY_TYPE(query) == GST_QUERY_ALLOCATION) {
    GstStructure * params = gst_structure_new ("allocation-meta", "myparam", G_TYPE_STRING, "my_value", NULL);
    gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, params);
} else {
    gst_pad_query_default (pad, parent, query);
 }
  return TRUE;

I’m able to receive GST_QUERY_ALLOCATION in elem_b and elem_c, but I’m getting an error while parsing allocation meta in elem_a.