Skip to content

fix: 🐛 Prevent crashes and ANR on network loss during playback#495

Open
lavigarg-simform wants to merge 1 commit into
mainfrom
fix/I488_fix_android_release_crash
Open

fix: 🐛 Prevent crashes and ANR on network loss during playback#495
lavigarg-simform wants to merge 1 commit into
mainfrom
fix/I488_fix_android_release_crash

Conversation

@lavigarg-simform

@lavigarg-simform lavigarg-simform commented Jun 19, 2026

Copy link
Copy Markdown

Description

Fixes three Android crash/freeze problems in playback and waveform extraction.

1. Crash when the extractor is stopped twice. Stop ran once at end-of-file and again on dispose, hitting an already-released codec (IllegalStateException: codec is released already). Teardown and decode callbacks now share a lock and a released flag, and codec references are cleared on stop. (#477, crash part of #478)

2. Crash on network drop. A lost connection during playback was reported as a hard error. Transient errors on a prepared player now auto-retry from the same position (5 attempts, 3s apart); unrecoverable loss shuts down cleanly and notifies Flutter instead of crashing. A single-reply guard ensures the prepare call responds once.

3. ANR on slow/dead network. Extraction setup ran on the main thread. It now runs on a background thread, and a failed extraction is caught and logged on the Dart side.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #488
Closes #477

Partially addresses #478 — this PR fixes the crash on ID3v2.4 files.

@lavigarg-simform lavigarg-simform force-pushed the fix/I488_fix_android_release_crash branch from 08b7fda to 3f5478e Compare June 19, 2026 15:07
@lavigarg-simform lavigarg-simform marked this pull request as ready for review June 19, 2026 15:10
lavigarg-simform added a commit that referenced this pull request Jun 23, 2026
Add configurable Android audio source plus opt-in noise suppression, acoustic echo cancellation and automatic gain control, attached to the recording session and released on teardown. Fail loudly when AudioRecord fails to initialise for an unsupported source/sampleRate combination.

Also keeps the CommonEncoder end-of-stream / stop() hang fix (the bundled AudioPlayer and WaveformExtractor fixes were dropped in favour of #495, which this branch is based on).

Closes #442, #381

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lavigarg-simform lavigarg-simform linked an issue Jun 24, 2026 that may be closed by this pull request
@lavigarg-simform lavigarg-simform marked this pull request as draft June 24, 2026 12:56
@lavigarg-simform lavigarg-simform force-pushed the fix/I488_fix_android_release_crash branch from 3f5478e to 4dfc28b Compare June 24, 2026 13:15
@lavigarg-simform lavigarg-simform force-pushed the fix/I488_fix_android_release_crash branch from 4dfc28b to 83f6e35 Compare June 24, 2026 14:39
@lavigarg-simform lavigarg-simform marked this pull request as ready for review June 24, 2026 14:51
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 release mode crash : Fatal Exception: java.lang.IllegalStateException: Reply already submitted Android bug : "codec is released already"

1 participant