Skip to content

fix(android): handle ADTS file write and close failures - #1342

Merged
mdydek merged 1 commit into
software-mansion:feat/adts-codec-supportfrom
wildseansy:fix/adts-write-errors
Oct 13, 2026
Merged

mdydek merged 1 commit into
software-mansion:feat/adts-codec-supportfrom
wildseansy:fix/adts-write-errors

Conversation

@wildseansy

Copy link
Copy Markdown
Contributor

Follow-up to #1333, targeting feat/adts-codec-support.

Buffered ADTS writes can succeed even when the following flush fails. Report fflush and fclose errors, and count frame bytes only after a successful flush. Own the output file with a closing smart pointer so an early codec-drain failure also releases it when the backend is destroyed.

Document ADTS .aac concatenation, matching sample rates/channel configurations, and removal of incomplete trailing frames. Preserve the feature branch's enum ordering and per-frame flush behavior.

Validation:

  • Android NDK 27.1 C++20 syntax check of the full AndroidEncoder.cpp translation unit for arm64/API 24, using React Native 0.87.0 JSI headers.
  • Local isolated C++ fault-injection harness using the extracted ADTS backend and real ADTS header implementation, with mocked codec/I/O boundaries: reproduced ignored flush/close failures, incorrect byte counting after failed flush, and missing cleanup in the original; all 12 checks pass with this patch. Also checked normal writes, short writes, start failure cleanup, and closing exactly once. This harness is local and is not an Android device test.
  • git diff --check passes.

@github-actions

Copy link
Copy Markdown

WPT non-regression comparison

PASS — no regressions · 0 improved section(s) · overall 3427 → 3427 (0)

Unchanged sections (28)
Spec section Base pass Head pass Delta
Processing model 1 1 0
Other 56 56 0
AnalyserNode 138 138 0
AudioBuffer 140 140 0
AudioBufferSourceNode 220 220 0
AudioContext 58 58 0
AudioNode 261 261 0
AudioParam 680 680 0
BiquadFilterNode 275 275 0
ChannelMergerNode 30 30 0
ChannelSplitterNode 7 7 0
ConstantSourceNode 64 64 0
ConvolverNode 178 178 0
DelayNode 127 127 0
DestinationNode 0 0 0
DynamicsCompressorNode 4 4 0
GainNode 15 15 0
IIRFilterNode 87 87 0
MediaElementAudioSourceNode 0 0 0
MediaStreamAudioDestinationNode 1 1 0
MediaStreamAudioSourceNode 0 0 0
OfflineAudioContext 35 35 0
OscillatorNode 104 104 0
PannerNode 727 727 0
PeriodicWave 33 33 0
ScriptProcessorNode 0 0 0
StereoPannerNode 104 104 0
WaveShaperNode 82 82 0

Baseline: 8b7d3124ae4f8452d3c5dcebfb1bc800d4a3b8c0 · Candidate: b81e3a5ce15cad5b074046a6305e38c652dbd16e

Workflow run · this comment is updated on every push.

@closetcaiman closetcaiman added fix Code changes specifically addressing and resolving a bug android Native Android implementation, C++/Java/Kotlin bindings, or Android-specific issues labels Oct 12, 2026
@mdydek

mdydek commented Oct 13, 2026

Copy link
Copy Markdown
Member

thank you

@mdydek
mdydek merged commit 6701fc2 into software-mansion:feat/adts-codec-support Oct 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

android Native Android implementation, C++/Java/Kotlin bindings, or Android-specific issues fix Code changes specifically addressing and resolving a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants