mediacodec: Set the dequeue timeout in the right unit

The timeout parameter is in microseconds, while the previous wait
value (30) was supposed to be milliseconds.

Signed-off-by: Martin Storsjö <martin@martin.st>
mediacodec: implementation of MediaCodec GPU direct rendering

Based on the work by Martin Storsjö.

The decoder stores opaque buffers in the p_sys member of the picture
and the vout uses a callback from the decoder to render these
buffers. When the decoder flushes or closes, all the currently in
flight pictures (filled by the decoder but not displayed yet) need to
be invalidated. A mutex is required in order to prevent the vout from using
destroyed MediaCodec buffers.

In order to avoid a deadlock when exiting the decoder, a maximum number of polling
attempts was added in order to avoid blocking the decoder indefinitely if the vout
is not releasing output buffers anymore.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>