omxvideodec: increase the minimum number of allocated buffers

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
This commit is contained in:
Guillaume Desmottes 2017-07-03 16:33:06 +02:00 committed by Nicolas Dufresne
parent 8e0dc1d89d
commit a3805116df

View file

@ -578,11 +578,11 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self)
goto done; goto done;
} }
/* Need at least 2 buffers for anything meaningful */ /* Need at least 4 buffers for anything meaningful */
min = MAX (MAX (min, port->port_def.nBufferCountMin), 4); min = MAX (min + port->port_def.nBufferCountMin, 4);
if (max == 0) { if (max == 0) {
max = min; 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 */ /* Can't use pool because can't have enough buffers */
gst_caps_replace (&caps, NULL); gst_caps_replace (&caps, NULL);
} else { } else {