omxvideodec/enc: add hack updating nBufferCountActual before allocating
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 27 Apr 2018 14:26:36 +0000 (16:26 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 8 Jun 2018 07:44:49 +0000 (09:44 +0200)
commit9a8e863862835d6598cef6fdfb21fea0deeb056b
tree2b8d2da88764fc97ba58be0058581faba127a21e
parent338ff34e5ea5527475d7e56d71f13a422ad31620
omxvideodec/enc: add hack updating nBufferCountActual before allocating

The OMX specs states that the nBufferCountActual of a port has to default
to its nBufferCountMin. If we don't change nBufferCountActual we purely rely
on this default. But in some cases, OMX may change nBufferCountMin before we
allocate buffers. Like for example when configuring the input ports with the
actual format, it may decrease the number of minimal buffers required.
This method checks this and update nBufferCountActual if needed so we'll use
less buffers than the worst case in such scenarios.

SetParameter() needs to be called when the port is either disabled or
the component in the Loaded state.

Don't do this for the decoder output as
gst_omx_video_dec_allocate_output_buffers() already check
nBufferCountMin when computing the number of output buffers.

On some platform, like rpi, the default nBufferCountActual is much
higher than nBufferCountMin so only enable this using a specific gst-omx
hack.

https://bugzilla.gnome.org/show_bug.cgi?id=791211
omx/gstomx.c
omx/gstomx.h
omx/gstomxvideodec.c
omx/gstomxvideoenc.c