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
Dart device SDK Whisper drops the batch being transcribed when stop() is called #22393
Primary loop layer: Capture (Dart device SDK, local Whisper transcription)
Involves data loss, failed capture, or broken sync/trust: stopping while a batch is being transcribed loses up to 5 s of transcript without an error.
Describe the bug
In the Dart device SDK (sdks/device/dart), WhisperTranscriber.appendPcm hands each full batch (5 s by default) to the injected runner without awaiting it, and _flush drops the runner's result when it resolves after stop() has set _stopped. stop() only transcribes the audio that is still buffered. So if stop() is called while a batch is being transcribed, that batch's transcript is discarded, only the tail is delivered, and stop() completes before the batch finishes.
This is the Dart counterpart of #12964 (TypeScript, fixed by #20407) and #13618 (React Native, fixed by #13619). #21577 covers the Python SDK.
To Reproduce
final t =WhisperTranscriber(runner: (_) =>'hello', onTranscript: print, batchSeconds:1);
t.appendPcm(Uint8List(32000)); // one full 1 s batch of 16 kHz PCM16await t.stop();
A real runner (an async native Whisper call) loses its batch the same way whenever stop() arrives while it is still running.
Current behavior
Nothing is printed. The runner is called with the full batch, but _flush resumes after stop() has set _stopped and drops the result. With an async runner, the batch that was being transcribed is lost and only the tail is delivered.
Expected behavior
hello is printed before stop() completes. stop() should deliver a batch that is still being transcribed, then the buffered tail, in that order, and complete once every transcript has been delivered, as the TypeScript and React Native SDKs now do.
Evidence (upstream main at 267b255cc812d16598d5fab8d3963766f3672966)
Activity