Skip to content

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

Open
yayobyte wants to merge 1 commit into
numandev1:mainfrom
yayobyte:fix/android-exynos-encoder-start
Open

yayobyte wants to merge 1 commit into
numandev1:mainfrom
yayobyte:fix/android-exynos-encoder-start

Conversation

@yayobyte

Copy link
Copy Markdown

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>
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)

1 participant