Skip to content

fix(streaming): cancel upstream and free codec when listener cancels - #6

Merged
ppamorim merged 3 commits into
developmentfrom
feature/fixStreaming
Oct 16, 2026
Merged

ppamorim merged 3 commits into
developmentfrom
feature/fixStreaming

Conversation

@ppamorim

Copy link
Copy Markdown
Member

Summary

  • StreamOpusEncoder.bind and StreamOpusDecoder.bind were async* generators parked in await for. Cancelling while the source was idle never reached the generator, so upstream was never cancelled and the native codec leaked.
  • Both now bind through a StreamController (_bindNative) that destroys the codec and cancels upstream on cancel, and forwards pause/resume.
  • StreamOpusDecoder now also destroys its decoder on cancel and exposes destroy().

Fixes EPNW#21

Test plan

  • opus_dart_streaming_mock_test.dart extended with cancel-while-idle coverage
  • dart test in opus_dart

🤖 Generated with Claude Code

StreamOpusEncoder/StreamOpusDecoder.bind were async* generators parked in
await for, so cancelling while the source was idle hung forever, never
cancelled upstream and leaked the native codec. Bind through a
StreamController that destroys the codec and cancels upstream on cancel.
StreamOpusDecoder now also destroys its decoder and exposes destroy().

Fixes EPNW#21
@ppamorim
ppamorim merged commit 07cf21e into development Oct 16, 2026
13 checks passed
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.

1 participant