tree: 92126b908a867e03134207c8f346a577fad7be60
  1. common/
  2. jni/
  3. src/
  4. Android.bp
  5. AndroidManifest.xml
  6. AndroidTest-mcts.xml
  7. AndroidTest.xml
  8. copy_media.sh
  9. DynamicConfig.xml
  10. OWNERS
  11. README.md
tests/media/README.md

MediaV2 CTS Tests

Overview

This folder comprises of tests designed to verify MediaCodec components. The tests verify media extractors, media muxers, and media codecs functionality through both SDK and NDK APIs.

The test suite aims to:

  • Validate components against CDD (Compatibility Definition Document) requirements
  • Check functionality of media codec components and their plugins individually
  • Test interactions between codec components, extractors and muxers

Test Vectors

Android TestFramework automatically downloads and copies the required resources from url while running the tests. Manual download and copy is also supported. This can be done by running the script copy_media.sh. All Big Buck Bunny (bbb) test vectors used by this suite are derived from Blender Foundation. All Cosmos Laundromat (cosmat) test vectors used by this suite are derived from xiph.org

Test Organization

The test suite covers MediaCodec API in both normal operation and error scenarios. Error cases are separated into dedicated classes with “UnitTest” suffix (e.g., CodecUnitTest, MediaFormatUnitTest).

Running Tests

Basic Commands

# Run all Media V2 CTS tests
atest android.mediav2.cts

# Run specific test classes
atest MctsMediaV2TestCases:CodecDecoderTest CtsMediaV2TestCases:CodecDecoderTest

# Run unit tests for error cases
atest CtsMediaV2TestCases:CodecUnitTest CtsMediaV2TestCases:MediaFormatUnitTest

Test Selection Features

All tests support attributes for selective execution based on various criteria:

Filtering by Codec Name

Use codec-prefix to select codecs whose names begin with a specific prefix:

# Test only mainline MP3 codecs
atest MctsMediaV2TestCases -- --module-arg MctsMediaV2TestCases:instrumentation-arg:codec-prefix:=c2.android.mp3

# Test only mainline HEVC decoder
atest MctsMediaV2TestCases -- --module-arg MctsMediaV2TestCases:instrumentation-arg:codec-prefix:=c2.android.hevc.decoder

# Test all mainline c2 codecs
atest MctsMediaV2TestCases -- --module-arg MctsMediaV2TestCases:instrumentation-arg:codec-prefix:=c2

# Test all vendor c2 codecs
atest CtsMediaV2TestCases -- --module-arg CtsMediaV2TestCases:instrumentation-arg:codec-prefix:=c2

Filtering by Media Type

Use media-type-prefix to select codecs whose supported media types begin with a specific prefix:

# Test only AVC video codecs
atest MctsMediaV2TestCases -- --module-arg MctsMediaV2TestCases:instrumentation-arg:media-type-prefix:=video/avc
atest CtsMediaV2TestCases -- --module-arg CtsMediaV2TestCases:instrumentation-arg:media-type-prefix:=video/avc

# Test all video codecs
atest MctsMediaV2TestCases -- --module-arg MctsMediaV2TestCases:instrumentation-arg:media-type-prefix:=video
atest CtsMediaV2TestCases -- --module-arg CtsMediaV2TestCases:instrumentation-arg:media-type-prefix:=video

Use media-type-sel to select codecs handling specific media types:

# Test MP3 and Vorbis audio codecs
atest MctsMediaV2TestCases -- --module-arg MctsMediaV2TestCases:instrumentation-arg:media-type-sel:=mp3,vorbis
atest CtsMediaV2TestCases -- --module-arg CtsMediaV2TestCases:instrumentation-arg:media-type-sel:=mp3,vorbis

# Test CodecDecoderTest for codecs supporting media types video/avc and audio/mp4a-latm
atest MctsMediaV2TestCases:CodecDecoderTest -- --module-arg MctsMediaV2TestCases:instrumentation-arg:media-type-sel:=avc,aac
atest CtsMediaV2TestCases:CodecDecoderTest -- --module-arg CtsMediaV2TestCases:instrumentation-arg:media-type-sel:=avc,aac

Using Regular Expressions

Use codec-filter with regular expressions for more complex selection patterns:

# Run VideoEncoderTest for mainline AVC and VP9 encoders
atest MctsMediaV2TestCases:VideoEncoderTest -- --module-arg MctsMediaV2TestCases:instrumentation-arg:codec-filter:="c2\.android\.avc\.encoder\|c2\.android\.vp9\.encoder"

# Run all mainline audio encoders
atest MctsMediaV2TestCases -- --module-arg MctsMediaV2TestCases:instrumentation-arg:codec-filter:="^.*\.encoder$" --module-arg MctsMediaV2TestCases:instrumentation-arg:media-type-prefix:=audio

media-type-sel identifiers list

IdentifierFull Media Type
vp8video/x-vnd.on2.vp8
vp9video/x-vnd.on2.vp9
av1video/av01
apvvideo/apv
avcvideo/avc
hevcvideo/hevc
mpeg4video/mp4v-es
h263video/3gpp
mpeg2video/mpeg2
vrawvideo/raw
amrnbaudio/3gpp
amrwbaudio/amr-wb
mp3audio/mpeg
aacaudio/mp4a-latm
vorbisaudio/vorbis
opusaudio/opus
g711alawaudio/g711-alaw
g711mlawaudio/g711-mlaw
arawaudio/raw
flacaudio/flac
gsmaudio/gsm