This document is intended to help original equipment manufacturers (OEMs) properly implement support for Android media resource manager and related APIs.
The CodecCapabilities.getMaxSupportedInstances
interface
returns the maximum number of supported concurrent codec instances.
The CTS test
testGetMaxSupportedInstances(android.media.cts.MediaCodecCapabilitiesTest)
is used to enforce the proper maximum is set in
/etc/media_codecs.xml
.
Here is an example:
... <MediaCodecs> ... <Encoders> <MediaCodec name="OMX.<vendor>.video.encoder.avc" type="video/avc" > ... <Limit name="concurrent-instances" max="13" /> </MediaCodec> ... </Encoders> ... </MediaCodecs>
OEMs can use this test to generate the concurrent limits that pass the test. To do this:
There was 1 failure: 1) testGetMaxSupportedInstances(android.media.cts.MediaCodecCapabilitiesTest) junit.framework.AssertionFailedError: In order to pass the test, please publish following codecs' concurrent instances limit in /etc/media_codecs.xml: <MediaCodec name="OMX.<vendor>.video.encoder.mpeg4" type="video/mp4v-es" > <Limit name="concurrent-instances" max="13" /> </MediaCodec> <MediaCodec name="OMX.<vendor>.video.encoder.h263" type="video/3gpp" > <Limit name="concurrent-instances" max="13" /> </MediaCodec> <MediaCodec name="OMX.<vendor>.video.encoder.avc" type="video/avc" > <Limit name="concurrent-instances" max="13" /> </MediaCodec> <MediaCodec name="OMX.<vendor>.video.encoder.vp8" type="video/x-vnd.on2.vp8" > <Limit name="concurrent-instances" max="13" /> </MediaCodec> <MediaCodec name="OMX.<vendor>.video.decoder.avc" type="video/avc" > <Limit name="concurrent-instances" max="13" /> </MediaCodec> <MediaCodec name="OMX.<vendor>.video.decoder.avc.secure" type="video/avc" > <Limit name="concurrent-instances" max="4" /> </MediaCodec> <MediaCodec name="OMX.<vendor>.video.decoder.mpeg4" type="video/mp4v-es" > <Limit name="concurrent-instances" max="12" /> </MediaCodec> <MediaCodec name="OMX.<vendor>.video.decoder.h263" type="video/3gpp" > <Limit name="concurrent-instances" max="12" /> </MediaCodec> <MediaCodec name="OMX.<vendor>.video.decoder.vp8" type="video/x-vnd.on2.vp8" > <Limit name="concurrent-instances" max="12" /> </MediaCodec>
concurrent-instances
lines suggested in the test
failure message to the /etc/media_codecs.xml
file.
The VideoCapabilities.getAchievableFrameRatesFor
interface
returns the range of achievable video frame rates for a video size. This
information must be provided by the OEM for each device via an XML file placed at
/etc/media_codecs_performance.xml
. These settings are tested by
the com.android.cts.videoperf.VideoEncoderDecoderTest
and
android.media.cts.VideoDecoderPerfTest
CTS tests.
OEMs can use the CTS tests to generate the XML files that pass the tests. To do this:
/etc/media_codecs_performance.xml
PRODUCT_COPY_FILES
line to device.mk
like so:
PRODUCT_COPY_FILES += \ ... device/moto/shamu/media_codecs.xml:system/etc/media_codecs.xml \ + device/moto/shamu/media_codecs_performance.xml:system/etc/media_codecs_performance.xml
media_codecs.xml
file.
<MediaCodecs> <Settings> <Setting name="supports-secure-with-non-secure-codec" value="false" /> </Settings> <Encoders> …
media_codecs.xml
file.
<MediaCodecs> <Settings> <Setting name="supports-multiple-secure-codecs" value="false" /> </Settings> <Encoders> …
media_codecs.xml
.
ResourceManagerTest
CTS tests may fail if these two settings were not set
properly.