You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AudioRecorder: the stream from startStream never ends when the platform's capture ends #632
OS: Linux (Ubuntu 24.04). The code involved is platform-independent.
Describe the bug
_startRecordStream (lib/src/part/record_stream.dart) re-emits the platform stream through its own broadcast controller. It forwards data (7.x also errors) but not the done event: stream.listen(...) has no onDone, and the controller closes only when the app itself calls stop, cancel, dispose or startStream again. So when a capture ends on the platform's side (the capture process dies, the device goes away, or on Linux another recorder stops it: #631), the stream startStream returned goes silent but never completes, and its owner can't tell its capture has ended.
On Linux, start a stream and listen with an onDone:
final a =AudioRecorder();
final stream =await a.startStream(
constRecordConfig(encoder:AudioEncoder.pcm16bits, numChannels:1),
);
stream.listen((_) {}, onDone: () =>print('done'));
final other =AudioRecorder();
await other.listInputDevices();
await other.dispose();
See: the data stops, and done is never printed.
Expected behavior
When the platform stream is done, the stream from startStream closes too, so the caller's onDone runs; for instance onDone: () => _recordStreamCtrl?.close() in _startRecordStream.
Additional context
Measured with flutter test on the machine above, with RecordPlatform.instance = RecordLinux() (record_linux 1.3.1): no data after the second recorder's dispose, and onDone never ran in the following 1.5 s.
Confirmed with record 7.1.2 on Linux (record_linux 2.1.3). Since #631 is fixed, a second recorder no longer ends the capture, so I ended it by killing the recorder's parecord from outside: the stream from startStream now completes, and onDone ran 1 ms after the kill.
Activity
llfbandit commentedon Oct 9, 2026
Thanks for the report.
record 7.1.2 has been released with the fix.
siegblink commentedon Oct 13, 2026
Confirmed with record 7.1.2 on Linux (record_linux 2.1.3). Since #631 is fixed, a second recorder no longer ends the capture, so I ended it by killing the recorder's
parecordfrom outside: the stream fromstartStreamnow completes, andonDoneran 1 ms after the kill.Thanks!
fix(record): End the startStream() stream when the platform ends it.
fix(record): End the startStream() stream when the platform ends it.