Commit Graph

34 Commits

Author SHA1 Message Date
sfan5
a7425f712a avcodec/mediacodec_wrapper: use MediaCodecInfo.isSoftwareOnly() when available
Added in Android 10 it provides a reliable way of filtering out
software decoders, unlike existing string-based checks.
2021-03-10 14:09:14 +01:00
sfan5
1a033008e8 avcodec/mediacodec_wrapper: check if codec is software earlier 2021-03-10 14:09:04 +01:00
Matthieu Bouron
5216edbc54 avcodec/mediacodec_wrapper: fix {input,output}_buffers global reference leak
Fixes ticket #8607.

Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2020-04-15 09:43:16 +02:00
Matthieu Bouron
817235b195 avcodec/mediacodec_wrapper: remove unused local variables in ff_AMediaCodec_getCodecNameByType() 2019-07-22 08:57:33 +02:00
Matthieu Bouron
3f232d713d avcodec/mediacodec_wrapper: fix a potential local reference leak in ff_AMediaCodec_getCodecNameByType() 2019-07-22 08:57:33 +02:00
Matthieu Bouron
9cb8875c16 avcodec/mediacodec_wrapper: fix a local reference leak in ff_AMediaCodec_getName() 2019-07-22 08:57:33 +02:00
Aman Gupta
f6d48b618a avcodec/mediacodec: add av_mediacodec_render_buffer_at_time()
The existing av_mediacodec_release_buffer allows the user to render
or discard the Surface-backed frame. This new method allows the user
to control exactly when the frame will be rendered to its SurfaceView.

Available since Android API 21.

Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-10-11 20:51:14 -07:00
Aman Gupta
fe0a6bcbda avcodec/mediacodec_wrapper: add helper to fetch SDK_INT
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-04 11:51:45 -07:00
Michael Niedermayer
c0bce367e4 avcodec: Fix AVClass .version
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-19 23:44:13 +02:00
Stefan _
5ab0ecf283 avcodec/mediacodec_wrapper: fix false positives in swdec blacklist
'OMX.SEC.avc.dec' is a valid hardware decoder, while the decoders
we seek to blacklist all match 'OMX.SEC.*.sw.dec'.
2018-03-07 13:52:02 +01:00
Stefan _
313b6057fb avcodec/mediacodec_wrapper: blacklist more software decoders
Additionally blacklist ffmpeg, Samsung and Qualcomm
software implementations offered through MediaCodec.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2018-03-06 13:52:24 -08:00
Matthieu Bouron
c55ba52a6a avcodec/mediacodec_wrapper: load and use MediaFormat.constainsKey()
Avoids triggering an exception in MediaFormat getter functions if the
key does not exist.
2018-03-03 21:18:35 +01:00
Matthieu Bouron
e30b46b1ae lavc/mediacodec_wrapper: allocate MediaCodec.BufferInfo once 2018-01-06 22:12:51 +01:00
Matthieu Bouron
1f1207145a lavc/mediacodec_wrapper: fix potential jni global reference leak 2017-12-16 00:52:28 +01:00
Matthieu Bouron
f3cffd121b lavc/mediacodec_wrapper: factorize MediaCodec creation functions 2017-12-16 00:52:28 +01:00
Matthieu Bouron
dd8ffb191f lavc/mediacodec_wrapper: fix jni vaargs types
Fixes decoding on 32-bit devices with Android NDK >= 15.
2017-09-15 14:19:16 +02:00
Matthieu Bouron
fb3228bee8 lavc/mediacodec_wrapper: do not declare JNIAMedia{Codec,CodecList,Format}Fields on the stack 2017-05-23 15:25:07 +02:00
Matthieu Bouron
224bb46fb8 lavc/mediacodec_wrapper: fix local reference leaks 2017-05-23 15:25:03 +02:00
Matthieu Bouron
1795dccde0 lavc/mediacodec_wrapper: fix local reference leaks
Reviewed-by: Clément Bœsch <u@pkh.me>
2017-05-11 16:29:03 +02:00
Matthieu Bouron
b8c158a4ed lavc/mediacodec_wrapper: do not discard codecs reporting they do not support any profile
Depending on the device, some (VP8/VP9/...) decoders report that they do
not support any profiles.
2016-10-19 09:52:15 +02:00
Matthieu Bouron
140da8e810 lavc: add hevc mediacodec decoder 2016-09-15 21:48:28 +02:00
Matthieu Bouron
376d8fb2c5 lavc/ffjni: replace ff_jni_{attach,detach} with ff_jni_get_env
If a JNI environment is not already attached to the thread where the
MediaCodec calls are made the current implementation will attach /
detach an environment for each MediaCodec call wasting some CPU time.

ff_jni_get_env replaces ff_jni_{attach,detach} by permanently attaching
an environment (if it is not already the case) to the current thread.
The environment will be automatically detached at the thread destruction
using a pthread_key callback.

Saves around 5% of CPU time (out of 20%) while decoding a stream with
MediaCodec.
2016-07-27 15:43:39 +02:00
Matthieu Bouron
0f2654c9a3 lavc: add mediacodec hwaccel support 2016-07-08 17:02:37 +02:00
Matthieu Bouron
346b3c5c41 lavc/mediacodec: re-indent after previous commit 2016-06-15 16:40:36 +02:00
Matthieu Bouron
e452abc5c2 lavc/mediacodec: refactor ff_AMediaCodecList_getCodecByType
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.
2016-06-15 16:36:13 +02:00
Matthieu Bouron
93f4d1646e lavc/mediacodec: bypass width/height restrictions when looking for a decoder
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.
2016-06-07 10:22:20 +02:00
Matthieu Bouron
cb89fd2334 lavc/mediacodec: rename MediaFormat field clazz to mediaformat_class for consistency 2016-06-07 10:20:44 +02:00
Matthieu Bouron
56ef387e21 lavc/mediacodec: move struct declarations at the begin 2016-06-07 10:20:44 +02:00
Matthieu Bouron
79efd3b8b8 lavc/mediacodec: rename jfields_mapping to jni_amediacodeclist_mapping 2016-06-07 10:20:36 +02:00
Matthieu Bouron
f2e7f9966e lavc/mediacodec: do not delete a local reference twice in case of error 2016-06-07 10:18:11 +02:00
Matthieu Bouron
d14deeb6bc lavc/mediacodec: add missing MediaCodec.Get{Input,Output}Buffer() checks 2016-05-25 16:46:47 +02:00
Matthieu Bouron
fbc9359d85 lavc/mediacodec: factorize static fields initialization 2016-05-25 16:46:47 +02:00
Matthieu Bouron
03a6ed83b0 lavc/mediacodec: remove stray empty lines 2016-03-15 10:33:16 +01:00
Matthieu Bouron
4737fe6907 lavc: add h264 mediacodec decoder 2016-03-07 11:28:29 +01:00