Skip to content

fix(android): drop KEY_PRIORITY/KEY_OPERATING_RATE so Exynos encoders can start (#423) - #424

Merged
numandev1 merged 1 commit into
numandev1:mainfrom
yayobyte:fix/android-exynos-encoder-start
Oct 25, 2026
Merged

numandev1 merged 1 commit into
numandev1:mainfrom
yayobyte:fix/android-exynos-encoder-start

Conversation

@yayobyte

Copy link
Copy Markdown
Contributor

Summary

Fixes #423.

On Samsung Exynos devices, Video.compress rejects at higher output resolutions (e.g. 1080p in manual mode):

W ExynosVideoEncCodec-H264-Intf: [checkRealTimeResource] real-time(32767 fps) is not supported
E ExynosC2H264EncComponent: [tryGetResource] obtaining real time resource is failed
E MediaCodec: Codec reported err 0xfffffff4/NO_MEMORY, actionCode 0, while in state 5/STARTING

#399 added KEY_PRIORITY = 0 (realtime) and KEY_OPERATING_RATE = Short.MAX_VALUE to the encoder format as a throughput hint. c2.exynos.h264.encoder accepts them in configure() but fails start() when the job exceeds its realtime budget. The prepareEncoder fallback only covers configure() failures, so the error reaches JS, and no option can disable the keys. Small auto outputs (360×640) still fit the budget, which is why it's resolution-dependent.

Changes:

iOS is unaffected.

Changelog

[ANDROID] [FIXED] - Video compression failing with NO_MEMORY on Samsung Exynos encoders

Test Plan

  • Ran local JS PR gate: yarn test:pr (passes)
  • Ran yarn test:harness:android on an emulator (Pixel 8 Pro, API 35): 9/9 passed. The harness has no Video.compress case, so this is a regression check only.

On-device before/after with the bare example app on a Galaxy A56 (SM-A566E, Exynos 1580, Android 16). Source: 94.1 MB, H.264 1920×1080 portrait, 120 fps, 17 Mbps, 43.6 s. Encoder in all runs: c2.exynos.h264.encoder.

Native code Options Result
main (keys set) default auto (→ 360×640) ✅ succeeds
main (keys set) manual, maxSize: 1920, bitrate: 5_600_000 ❌ NO_MEMORY in STARTING, promise rejects
this PR manual, maxSize: 1920, bitrate: 5_600_000 ✅ 31.97 MB, H.264 High 1080×1920, 5.6 Mbps, AAC kept, same duration

Not tested on Qualcomm/MediaTek devices without the hint. Throughput there may drop somewhat, but output should be unchanged.

🤖 Generated with Claude Code

… can start (numandev1#423)

Exynos H.264 encoders (c2.exynos.h264.encoder) accept the realtime
priority + max operating rate hint in configure() but fail start() with
NO_MEMORY ("real-time(32767 fps) is not supported") at higher
resolutions such as 1080p. The prepareEncoder fallback only covers
configure() failures, so Video.compress rejected.

Fixes numandev1#423

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oeddyo

oeddyo commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

we are encountering this issue too

@numandev1 could you please take a look when you have a second?

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.

🟢 Approval recommended

The narrow removal addresses the reported failure, preserves required encoding settings, and is supported by targeted device validation with no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes #423 by removing Android encoder scheduling hints introduced in #399 that caused Samsung Exynos encoders to fail at startup. Required encoding parameters and fallback behavior remain unchanged; iOS is unaffected.

Changes:

  • Remove KEY_PRIORITY and KEY_OPERATING_RATE from the encoder format.
  • Update fallback comments to describe only the remaining VBR setting.
  • Document the Exynos limitation and record the fix in triage notes.

The PR reports successful Galaxy A56 before/after validation. Native behavior was not independently runtime-verified during this review.

File Description
TRIAGE.md Records #423, its cause, and reported device validation.
CLAUDE.md Documents the encoder scheduling-key pitfall.
android/​src/​main/​java/​com/​reactnativecompressor/​Video/​VideoCompressor/​utils/​CompressorUtils.kt Removes the two scheduling hints that trigger Exynos startup failures.
android/​src/​main/​java/​com/​reactnativecompressor/​Video/​VideoCompressor/​compressor/​Compressor.kt Updates comments only to reflect the remaining VBR fallback.

Review effort: Balanced

@numandev1
numandev1 merged commit b9cef9d into numandev1:main Oct 25, 2026
@oeddyo

oeddyo commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Thank you so much @numandev1 <3

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.

[Android] Video.compress fails with NO_MEMORY on Samsung Exynos devices at 1080p (2.0.x)

4 participants