Skip to content

fix: blacklist QTI AVC encoder's legacy OMX alias in pickAvcEncoder - #416

Merged
numandev1 merged 1 commit into
numandev1:mainfrom
oeddyo:fix/qti-avc-encoder-omx-alias
Jul 25, 2026
Merged

fix: blacklist QTI AVC encoder's legacy OMX alias in pickAvcEncoder#416
numandev1 merged 1 commit into
numandev1:mainfrom
oeddyo:fix/qti-avc-encoder-omx-alias

Conversation

@oeddyo

@oeddyo oeddyo commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

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 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: 0xffffffff at the first input-surface dataspace change — surfacing to JS as IllegalStateException: Invalid to call at Released state from dequeueOutputBuffer (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 (contains covers the .secure variant too). Selection then falls to c2.android.avc.encoder on 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:

build log outcome
before encoder selected: OMX.qcom.video.encoder.avc instant failure, 3/3 attempts
after encoder selected: c2.android.avc.encoder clean transcode, every attempt

Logcat excerpts of the full codec death sequence available on request.

🤖 Generated with Claude Code

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.
@oeddyo

oeddyo commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

This might fix issues reported:
#412
#409

Could you please take a look @XChikuX

@XChikuX

XChikuX commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Minimal. And looks fine to me. If you've tested this, then it should be fine.

I'm not the repo owner though.

@numandev1

@oeddyo

oeddyo commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Minimal. And looks fine to me. If you've tested this, then it should be fine.

I'm not the repo owner though.

@numandev1

Thanks for the reply. Yes - this is tested on a S23 bought specifically for this mysterious bug 😄

@XChikuX

XChikuX commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@numandev1 backport to v1 branch would also be appreciated.

@oeddyo

oeddyo commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@numandev1 Hi Numan, do you mind take a quick look please?

@oeddyo

oeddyo commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@numandev1 Hi Numan, could you please share a few minutes to take a look and merge so we get it fixed?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .secure variant 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.

@numandev1 numandev1 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@numandev1
numandev1 merged commit 1f9f995 into numandev1:main Jul 25, 2026
@numandev1

Copy link
Copy Markdown
Owner

released in 2.0.3

@XChikuX

XChikuX commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@numandev1 backport to v1 branch would also be appreciated.

@numandev1 When you get time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants