Ensure that enough buffers are allocated by adding up component's own
minimal plus the number of buffers requested by downstream.
This should prevent buffers starvation problem if downstream elements
are holding some of the buffers they required.
Also simplify the check on the maximum on buffers. What we actually care
about is to make sure the pool can hold the minimum of required buffers.
https://bugzilla.gnome.org/show_bug.cgi?id=784479
goto done;
}
- /* Need at least 2 buffers for anything meaningful */
- min = MAX (MAX (min, port->port_def.nBufferCountMin), 4);
+ /* Need at least 4 buffers for anything meaningful */
+ min = MAX (min + port->port_def.nBufferCountMin, 4);
if (max == 0) {
max = min;
- } else if (max < port->port_def.nBufferCountMin || max < 2) {
+ } else if (max < min) {
/* Can't use pool because can't have enough buffers */
gst_caps_replace (&caps, NULL);
} else {