From 40956d161b3581b8073cb52974072b78c0f5aff6 Mon Sep 17 00:00:00 2001 From: Eddie Xie Date: Wed, 22 Jul 2026 11:42:29 -0700 Subject: [PATCH] fix: blacklist QTI AVC encoder's legacy OMX alias in pickAvcEncoder 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. --- .../Video/VideoCompressor/compressor/Compressor.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/reactnativecompressor/Video/VideoCompressor/compressor/Compressor.kt b/android/src/main/java/com/reactnativecompressor/Video/VideoCompressor/compressor/Compressor.kt index f35f663..01ddc5a 100644 --- a/android/src/main/java/com/reactnativecompressor/Video/VideoCompressor/compressor/Compressor.kt +++ b/android/src/main/java/com/reactnativecompressor/Video/VideoCompressor/compressor/Compressor.kt @@ -734,8 +734,12 @@ object Compressor { } fun isBlacklisted(name: String): Boolean { + // ALL_CODECS also surfaces the legacy OMX alias of the QTI encoder + // (OMX.qcom.video.encoder.avc). createByCodecName resolves the alias + // back to c2.qti.avc.encoder, so it must be blacklisted under both + // names. The shorter needle also covers the ".secure" variant. val lower = name.lowercase() - return lower.contains("c2.qti.avc.encoder") || lower.contains("omx.qcom.video.encoder.avc.secure") + return lower.contains("c2.qti.avc.encoder") || lower.contains("omx.qcom.video.encoder.avc") } fun isSoftware(info: MediaCodecInfo): Boolean {