4

My app create several instance of MediaCodec which work parallel as video/audio decoders and encoders.

I know that video codec has limiting buffer space and this limit depends on device.

For example on tab Samsung SM-P600 I can create four MediaCodecs with resolution 720p:

1280*720*4=3686400

but not five:

1280*720*5=4608000

Because codec will return error during configuring:

E/OMX: setParam sum(4608000) > max resolution(4177920) E/ACodec: [OMX.Exynos.AVC.Encoder] failed to set input port definition parameters. E/ACodec: configureCodec multi window instance fail appPid : 17054 E/ACodec: [OMX.Exynos.AVC.Encoder] configureCodec returning error -1021 E/ACodec: signalError(omxError 0x80001001, internalError -1021) E/MediaCodec: Codec reported err 0xfffffc03, actionCode 0, while in state 3 E/MediaCodec: configure failed with err 0xfffffc03, resetting... 

How can I get max resolution(4177920) before configuring MediaCodecs to count max available resolutions for all MediaCodecs I need?

1
  • Were you able to solve this? I am also unable to find a MediaCodec interface to get this max resolution sum. Commented Aug 6, 2019 at 12:26

1 Answer 1

2

Try to use getMaxSupportedInstances () in MediaCodecInfo.CodecCapabilities. https://developer.android.com/reference/android/media/MediaCodecInfo.CodecCapabilities.html

Or isSizeSupported(int width, int height) in MediaCodecInfo.VideoCapabilities. https://developer.android.com/reference/android/media/MediaCodecInfo.VideoCapabilities.html

Sign up to request clarification or add additional context in comments.

3 Comments

It is good solution "use getMaxSupportedInstances ()", but not all devises return this info, for example Samsung p600 doesn't.
getMaxSupportedInstances () has nothing to do with resolutions
getMaxSupportedInstances() returns the number of codecs that can run in parallel

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.