How Android MediaCodec Exposes AV1 Decoders

This article provides an overview of how the Android MediaCodec framework identifies, prioritizes, and exposes both hardware and software AV1 video decoders to applications. It covers the underlying Codec 2.0 (C2) architecture, the standard component naming conventions, how developers query decoder capabilities via system APIs, and how Android manages fallback behavior between vendor hardware implementations and built-in software decoders like libgav1 and dav1d.

The Unified MIME Type Architecture

Android handles all AV1 decoding under a single standardized media type: video/av01. When an application requests an AV1 decoder, the MediaCodec framework does not initially require the app to know whether the processing will occur on a dedicated hardware chip or through the CPU.

Instead, the framework acts as an abstraction layer over Android’s Codec 2.0 (C2) framework (or the legacy OpenMAX IL layer on older versions). The system maintains an internal media codec registry parsed from system XML configuration files (such as /vendor/etc/media_codecs.xml and /system/etc/media_codecs.xml). When initialized, MediaCodec reads these registries to index all available AV1 decoder components, their performance ratings, and their supported profiles.

Hardware vs. Software Naming Conventions

The MediaCodec framework distinguishes hardware and software decoders using standardized component names:

Discovery and Enumeration via MediaCodecList

Applications discover which AV1 decoders are present on a device through the MediaCodecList class. Android exposes decoder properties through MediaCodecInfo, allowing developers to programmatic inspect the hardware status:

  1. MediaCodecInfo.isHardwareAccelerated(): Returns true if the underlying component is a vendor-supplied hardware implementation.
  2. MediaCodecInfo.isSoftwareOnly(): Returns true if the component executes entirely on the CPU (e.g., standard Android C2 software fallbacks).
  3. MediaCodecInfo.isVendor(): Distinguishes OEM/SoC implementations from default Android open-source components.

When calling MediaCodec.createDecoderByType("video/av01"), Android automatically resolves the call by returning the component with the highest internal ranking that supports the requested MIME type. The framework systematically ranks hardware decoders higher than software fallbacks, ensuring efficient decoding whenever dedicated hardware support exists.

Profile, Level, and Capability Negotiation

AV1 decoders exposed via MediaCodec specify exact format limits through MediaCodecInfo.CodecCapabilities. Android maps AV1 standard profiles (Main Profile, High Profile, and Professional Profile) to integer constants defined within MediaCodecInfo.CodecProfileLevel:

Hardware decoders advertise specific performance constraints, such as maximum supported resolution (e.g., 4K or 8K) and maximum frame rates, through VideoCapabilities. If a requested video stream exceeds the capabilities of a hardware decoder (such as a 4K 10-bit stream on a chip that only supports 1080p AV1 hardware decoding), MediaCodecList.findDecoderForFormat() allows an application to selectively fall back to a software decoder capable of handling the target configuration.