Skip to content

fix(android): make OpenSL capture shutdown deterministic - #52

Open
Avejack wants to merge 2 commits into
alnitak:mainfrom
Avejack:fix/android-opensl-capture-shutdown
Open

fix(android): make OpenSL capture shutdown deterministic#52
Avejack wants to merge 2 commits into
alnitak:mainfrom
Avejack:fix/android-opensl-capture-shutdown

Conversation

@Avejack

@Avejack Avejack commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Description

Stop Android OpenSL capture before clearing its queued buffers instead of waiting indefinitely for the input queue to drain. Some USB conference devices can leave a capture buffer queued after delivery stalls; the previous unbounded drain then prevented recorder stop/deinitialization from returning.

Playback keeps its existing drain behavior. The change adds a source-level regression test that verifies capture does not drain, capture stops before its queue is cleared, and playback still drains. It is also documented under ## Unreleased.

Closes #51.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

Verification

  • flutter test test/opensl_capture_shutdown_test.dart
  • flutter test
  • flutter analyze lib test
  • Physical Android USB conference-device start/stop/restart proof in the downstream application

Stop the OpenSL recorder before clearing queued capture buffers instead of waiting indefinitely for a stalled Android USB input queue to drain. Preserve playback draining, add regression coverage, and document the pending change.
Declare the build and platform exclusions added automatically by Flutter 3.47 so dependency resolution leaves the checkout clean before the pub.dev dry-run gate.
@alnitak

alnitak commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Hi @Avejack, thanks for your interest in this project.

I don't see any changes in the code! :)

I see a new comment in miniaudio and some fixes for the new Flutter version, but nothing in the code. Anyway, I'd prefer not to touch the miniaudio source since it is an external library.

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.

fix: prevent OpenSL capture shutdown from blocking on stalled queues

2 participants