From a3805116dff2f31e37436374a2719d6c4c584d73 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 3 Jul 2017 16:33:06 +0200 Subject: [PATCH] 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 --- omx/gstomxvideodec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 1b90caa..0f72c9c 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -578,11 +578,11 @@ gst_omx_video_dec_allocate_output_buffers (GstOMXVideoDec * self) 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 { -- 2.7.4