allocation: add event notifying downstream about allocated buffers
@gdesmott
Submitted by Guillaume Desmottes Link to original bug (#795747)
Description
We have a couple of use cases where elements would need to know about the buffers which have been allocated upstream:
- bug 794817 : Msdk requires to know all the dmabuf fds which will be used.
- bug 795746 : in gst-omx when using dynamic buffer mode, we'd like to have the same number of input/output buffers allocated on two consecutive ports.
This is not possible with the current allocation API. The ALLOCATION query retrieves information from downstream but does not propagate its own requirement or notify downstream about what has actually be allocated.
We could solve this by adding a new serialized downstream event sent once buffers have been allocated.
Here is the event I used in my local branch to try solving #795746
.
It is sent as soon as the pool has been activated.
gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM,
gst_structure_new ("buffers-allocated",
"nb-buffers", G_TYPE_UINT, min,
"pool", GST_TYPE_BUFFER_POOL, self->out_port_pool, NULL));
We could retrieve the number of buffers from the pool but having a specific field make it usable even if no pool is being used.
Open questions:
- Proper naming of this event and its fields.
- Should we resend this event if extra buffers are being allocated in the pool?