Replicates the logic used in the wrap_hw_buffer path to wrap_sw_buffer
as well.
Fixes decoding issues observed on AMLogic devices with
OMX.amlogic.mpeg2.decoder.awesome, where the decoder would spit out a
constant stream of "mPtsRecoveryCount" errors and decoded frames were
returned in the incorrect order.
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Increase buffer dequeue timeout when the codec needs to be drained as it
could happen that no input buffer is available when we receive a null
packet for the first time (meaning we are unable to signal end of stream
and mark the codec as draining).
Fixes potential loss of last frames after sending a null packet.
Allows to select a codec (encoder or decoder) only if it supports a
specific profile.
Adds ff_AMediaCodecProfile_getProfileFromAVCodecContext to convert an
AVCodecContext profile to a MediaCodec profile. It only supports H264
for now.
The codepath using MediaCodecList.findDecoderForFormat() (Android >= 5.0)
has been dropped as this method does not allow to select a decoder
compatible with a specific profile.
Codec width/height restrictions seem hardcoded at the OMX level and
seem arbitrary. Bypassing those restrictions allows a device to decode
streams at higher resolutions.
For example it allows a Nexus 5 to decode h264 streams with a resolution
higher than 1920x1080.