Summary: Android 16 makes media playback more efficient by cutting down on the number of processes required for decoding a video or audio. This is achieved by using media codecs written in Rust, a more efficient and secure language.
The upcoming version of Android is streamlining a lot of little features. Media Playback is the latest feature that will be optimized in Android 16.
This will improve Android’s performance in playing both offline and online media. Streaming music using Spotify or playing a YouTube video will also benefit from the change.
But what exactly is the change? Well, the explanation can get a bit technical, like the Vulcan API requirement we reported on earlier. So bear with us as we break it down into simpler terms.
Media codecs: The key factor
There was a time when video and audio files used to be massive, taking gigabytes to store a minute of footage. Then formats like MP4 and MP3 arrived, compressing media to much more palatable sizes.
The way they achieve this is by “encoding” the video or audio data. This squeezes the data into a small file but makes it impossible to play directly.
Media players have to then “decode” the file into playable media again. Codecs are the keys that contain information on how to decode these files.
Security makes it complicated
Codecs by themselves don’t pose an issue. A media player can easily spin a process in the background to contact the codec and decode the video or audio being played. The issue is permissions.
If the decoding and playback take place in the same process, an insecure codec can give hackers access to the whole system. To combat this, Android runs codecs in their own isolated process.
This means that even if the codec is vulnerable, the fallout cannot affect the app or the OS at large. On the flip side, this makes media playback very inefficient.
Every time an app needs to play a video or audio, it needs to query the codec process and then wait for the result. This introduces a small yet perceptible delay to media playback.
The solution: Rust
The whole problem with running codecs in the playback process was potential vulnerabilities. But what if there was a way to ensure that this process would have watertight security?
Rust is a programming language that focuses on efficient, secure code. By its very design, a Rust program cannot have memory vulnerabilities.
Android 16 improves media playback by using Rust codecs. These codecs will be run in the playback process itself, eliminating the need for multiple processes.
As of now, only the audio codec has been rewritten in Rust; video playback still uses the old approach. But the transition has started, and expect more vendors to release Rust codecs and improve media playback in Android 16.