WebRTC on Android: Enabling Hardware Encoding Across Devices
Article Summary
Ivan Dyatlov from Bumble Tech discovered that WebRTC's H.264 hardware encoding failed on most Android 5.x devices despite official support claims. His deep dive into codec implementations reveals why video calls drain batteries on millions of smartphones.
Bumble and Badoo needed reliable video calling across all Android devices, especially older models from 2014-2016 still widely used. The team expected H.264 hardware encoding to work seamlessly on Android 5.0+, but reality proved far messier. This article documents their journey through manufacturer-specific codec quirks and the fixes that enabled hardware encoding across diverse chipsets.
Key Takeaways
- WebRTC only enabled hardware encoding for Qualcomm and Exynos, blocking other chipsets
- Spreadtrum, MediaTek, HUAWEI, and MARVELL codecs needed custom bitrate and color format fixes
- Android CTS video tests grew from 160 lines in v4.3 to 740 in v10
- Switching from codec allowlist to blocklist unlocked hardware encoding on legacy devices
- Lenovo A1000 required variable bitrate mode due to Spreadtrum chipset limitations
Enabling H.264 hardware encoding across Android devices requires manufacturer-specific workarounds for color formats, bitrate modes, and resolution handling that standard WebRTC implementations miss.
About This Article
Ivan Dyatlov's team noticed that Android's Compatibility Test Suite video encoding tests ballooned from 160 lines of code in Android 4.3 to 740 in Android 10. Google didn't start serious codec compliance testing until version 5.0, which meant manufacturers ended up with inconsistent implementations across devices.
Badoo changed WebRTC's approach from an allowlist that only supported Qualcomm and Exynos chipsets to a blocklist targeting software codec prefixes like OMX.google and OMX.SEC. This let them detect hardware encoding on Spreadtrum, MediaTek, HUAWEI, and MARVELL chipsets that the old system missed.
The fixes enabled hardware encoding on most devices running Android 5.0 and 5.1. Analysis showed that the majority of users had Spreadtrum, MediaTek, HUAWEI, or MARVELL chipsets that had been falling back to software encoding. This reduced CPU load and battery drain on millions of older smartphones.