]> git.sesse.net Git - vlc/commit
omxil: Retry getting an output buffer while waiting for a free input buffer
authorMartin Storsjö <martin@martin.st>
Fri, 25 Jul 2014 21:11:33 +0000 (00:11 +0300)
committerMartin Storsjö <martin@martin.st>
Sat, 26 Jul 2014 12:09:41 +0000 (15:09 +0300)
commit1285807fbfccbbf0eb0792296c37ce309c4b1c41
tree48e38c2a92bfd8c5dda51d3b6ac19d797e18ec57
parentef230f418ff63cce58be09eb4ce1f235ac624676
omxil: Retry getting an output buffer while waiting for a free input buffer

As soon as either the input packet has been written, or an output
buffer is available, we return from the function, allowing passing
the output frames down the pipeline as soon as possible. (For
direct rendering, a new output buffer only become available for
the codec to use once the picture is rendered or discarded.)

This fixes playback with IOMX direct rendering on Nexus S, which
only uses 2 output buffers in this mode (min_undequeued = 1,
nBufferCountMin = 1), and probably also for other devices with
a small number of output buffers.

(On the Nexus S, the number of output buffers can't be increased,
since this leads to blinking.)

This is similar to how available input/output buffers are checked
in the MediaCodec plugin.

This still isn't completely foolproof with respect to the case when
an input packet needs to be split up over multiple input buffers
though, but it wasn't completely correct previously either.

Also make sure we don't return from the function without consuming
the input packet or returning an output frame, which earlier would
lead to a skipped input packet and leaked memory. (This could
previously happen on reconfiguration, or on timeout while waiting for
an input buffer.)

Finally, make sure we don't block indefinitely in case the playback
is paused (causing the decoder to block while waiting for a free
output buffer). The same solution as in the android mediacodec
decoder is used here.

Signed-off-by: Martin Storsjö <martin@martin.st>
modules/codec/omxil/omxil.c