fix: blacklist QTI AVC encoder's legacy OMX alias in pickAvcEncoder - #416
Conversation
pickAvcEncoder enumerates MediaCodecList(ALL_CODECS), which surfaces legacy OMX aliases alongside Codec2 names. On Snapdragon devices the blacklisted c2.qti.avc.encoder is also advertised as OMX.qcom.video.encoder.avc; that alias passes the c2-only blacklist check, wins the hardware-first preference, and createByCodecName resolves it back to the blacklisted component. Every compression on Qualcomm devices therefore ran on the encoder the blacklist exists to avoid - on Samsung One UI 8 (Android 16) it dies ~80ms after start with vendor error 0xffffffff, surfacing as "IllegalStateException: Invalid to call at Released state" from dequeueOutputBuffer. Match the alias in the blacklist (contains covers the .secure variant), restoring software-encoder selection on QTI devices. Verified on a physical Galaxy S23 (SM-S911U1, Android 16 / One UI 8.0): selection falls to c2.android.avc.encoder and compression completes where the alias path failed instantly on every attempt.
|
Minimal. And looks fine to me. If you've tested this, then it should be fine. I'm not the repo owner though. |
Thanks for the reply. Yes - this is tested on a S23 bought specifically for this mysterious bug 😄 |
|
@numandev1 backport to v1 branch would also be appreciated. |
|
@numandev1 Hi Numan, do you mind take a quick look please? |
|
@numandev1 Hi Numan, could you please share a few minutes to take a look and merge so we get it fixed? |
There was a problem hiding this comment.
Pull request overview
This PR fixes Android AVC encoder selection on Qualcomm (QTI) devices by ensuring pickAvcEncoder blacklists not only c2.qti.avc.encoder but also its legacy OMX alias (OMX.qcom.video.encoder.avc) that MediaCodecList(ALL_CODECS) can surface, preventing accidental selection of the previously-blacklisted encoder.
Changes:
- Extend the AVC encoder blacklist to match
OMX.qcom.video.encoder.avc(covers the.securevariant via substring match). - Add in-code documentation explaining why the alias must be blacklisted.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
released in |
@numandev1 When you get time :) |
pickAvcEncoderenumeratesMediaCodecList(ALL_CODECS), which surfaces legacy OMX aliases alongside Codec2 names. On Snapdragon devices the blacklistedc2.qti.avc.encoderis also advertised asOMX.qcom.video.encoder.avc— that alias passes the c2-only blacklist check, wins the hardware-first preference, andcreateByCodecNameresolves it right back to the blacklisted component. So every compression on Qualcomm devices runs on the encoder the blacklist exists to avoid.Observed in production (family photo app): on Samsung One UI 8 / Android 16 (Galaxy S21→S25) the encoder dies ~80 ms after
start()— logcat:CCodec: Component "c2.qti.avc.encoder" returned error: 0xffffffffat the first input-surface dataspace change — surfacing to JS asIllegalStateException: Invalid to call at Released statefromdequeueOutputBuffer(Compressor.kt:394). Likely related to #409. On devices where the encoder survives, output runs through the codec originally blacklisted for producing files unplayable on Mac/iOS.Fix: match the alias in the blacklist (
containscovers the.securevariant too). Selection then falls toc2.android.avc.encoderon QTI devices — the pre-2.x behavior. Non-Qualcomm devices are unaffected.Verified on a physical Galaxy S23 (SM-S911U1, Android 16 / One UI 8.0), same source clip:
encoder selected: OMX.qcom.video.encoder.avcencoder selected: c2.android.avc.encoderLogcat excerpts of the full codec death sequence available on request.
🤖 Generated with Claude Code