Repository navigation
fix(android): name the codec error when video compression fails (#428) - #429
Merged
numandev1 merged 1 commit intoOct 26, 2026
Merged
Conversation
…ndev1#428) A MediaCodec.CodecException usually has an empty message, so the rejection carried nothing. Append its diagnosticInfo, which names the codec error (e.g. android.media.MediaCodec.error_neg_12 for NO_MEMORY). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrow error-formatting change addresses the reported issue without altering compression behavior, and no blocking issues remain.
No open issues 🎉
What changed in this PR
Improves Android video compression errors for #428 by including codec diagnostics in failure messages, making failures such as Exynos NO_MEMORY identifiable from JavaScript.
Changes:
- Adds a shared formatter that includes
MediaCodec.CodecException.diagnosticInfoat both codec-work catch sites. - Preserves non-codec exception messages and leaves compression logic unchanged.
- Records the fix in the triage log.
The codec-exception branch was not runtime-verified, as noted in the test plan.
| File | Description |
|---|---|
| TRIAGE.md | Records #428 and its diagnostic-message fix. |
| android/src/main/java/com/reactnativecompressor/Video/VideoCompressor/compressor/Compressor.kt | Adds codec diagnostics to both relevant failure paths. |
Review effort: Balanced
numandev1
approved these changes
Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #428.
On Android, a
MediaCodec.CodecExceptionthrown duringVideo.compressusually has an empty message, so the promise rejects with nothing useful (CodecException:or juststart failed). Every codec failure looks the same from JS. Before #424 that is how the ExynosNO_MEMORYfailures reached us: empty, with the cause only in logcat.CodecException.getDiagnosticInfo()already names the error (android.media.MediaCodec.error_neg_12isNO_MEMORY). This PR appends it to the failure message at the two catch sites that wrap codec work inCompressor.start:Messages from other exceptions are unchanged. The
finishMovie()catch only touches the muxer, so it is left alone.Changelog
[ANDROID] [FIXED] - Video compression failures now name the MediaCodec error instead of an empty message
Test Plan
yarn test:pr(passes, 13/13)yarn build:android(BUILD SUCCESSFUL)yarn test:harness:androidon an arm64 API emulator: 8/9 passed. The one failure,compresses a real image fixture through the exported Image API(expected 16 to be less than or equal to 8), fails the same way on unmodifiedmainwith the same emulator, so it is unrelated. The harness has noVideo.compressfailure case, so this is a regression check only.The
CodecExceptionbranch was not runtime-verified: I couldn't force a realCodecExceptionon an emulator. ThediagnosticInfoformat comes from AOSPMediaCodec.CodecException("android.media.MediaCodec.error_" + (errorCode < 0 ? "neg_" : "") + Math.abs(errorCode)), available since API 21 (minSdk is 24).🤖 Generated with Claude Code