Files
Paul Adenot f1fee4ef28 Bug 1940906 - Perform speech recognition locally in the browser. r=media-playback-reviewers,alwu
Audio received from content over IPC is enqueued into a lock-free SPSC
queue; a background thread on the utility process dequeues it and feeds it
to the parakeet cache-aware streaming C-API. Since the model never revises
already-committed output, each newly committed chunk of text is emitted as
a final result once a word boundary is reached, with the trailing partial
word held for the next feed; the tail is flushed at end-of-stream.

Also hardens session teardown: RecvStop() and ActorDestroy() now clear the
active-session slot so it cannot be leaked, ActorDestroy() uses
AsyncShutdown() to avoid a reentrant event-loop pump while tearing down the
recognition thread, and the child side gains a DestroyedCallback so it can
drop its actor reference if the parent side goes away first.

For debugging, a MOZ_DUMP_AUDIO-gated WavDumper records the recognition
audio input, and a profiler marker is emitted for each result. The Parakeet
recognition thread is added to the profiler on-device-ML thread presets, so
those markers and the thread samples are captured without hand-editing the
Threads filter. An unrelated indentation fix to
media.webspeech.synth.enabled in StaticPrefList.yaml rode along.

The recognition loop is still being tuned and will change, but this is the
general idea.

Differential Revision: https://phabricator.services.mozilla.com/D268415
2026-09-02 12:30:05 +00:00
..