livekit-plugins-fishaudio: drop startup prebuffer#2033
Merged
Conversation
🦋 Changeset detectedLatest commit: a6d6279 The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: Cursor <cursoragent@cursor.com>
toubatbrian
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Port livekit/agents#6423 for Fish Audio streaming startup latency.
finalwhen present@livekit/agents-plugin-fishaudioVerification
pnpm --filter @livekit/agents-plugin-fishaudio... buildpnpm test -- plugins/fishaudio(credentialed integration test skipped because Fish/OpenAI keys are not configured)pnpm --filter @livekit/agents-plugin-fishaudio lintSource diff coverage
livekit-plugins/livekit-plugins-fishaudio/livekit/plugins/fishaudio/tts.pyplugins/fishaudio/src/tts.ts. The Python source removed_PREBUFFER_CHUNKS, thepush_audiostartup chunk accumulator, andflush_prebuffer, then pushed Fishaudioevents directly. The JS target did not have the same two-chunk Fish message prebuffer, but it did hold back one decodedAudioFrameto tagfinal; this PR removes that startup emission delay by queueing decoded audio frames immediately and only marking frames from the terminal flush asfinalwhen present.No source tests were added or modified in livekit/agents#6423, so no target tests were ported.
Ported from livekit/agents#6423
Original PR description
follow-up to #6368. removes the startup prebuffer, keeping the pooled/pre-warmed
websocket reuse.
the prebuffer was a stopgap for fish's cold-start chunk pacing: the old stream sent a
small first chunk (~460ms) then a big second chunk (~930ms) ~200ms later, leaving
webrtc playout only ~200ms of buffer headroom, which jitter turned into a first-word
crackle. so we held the first two chunks before starting playout.
fish has since shipped a server-side change: the second chunk is now ~464ms and
arrives ~60ms after the first. measured chunk-2 headroom (playout starting on the
first chunk):
so starting on the first chunk now has ~400ms of headroom, comfortably above webrtc
jitter, with no underruns. the prebuffer is no longer needed — this removes it so
audio starts on the first chunk for optimal latency. verified on a live demo (real
webrtc): no crackles.
net diff: 35 lines removed, connection pooling/prewarm untouched.
Cue voice E2E
sid_398f2c3dd1e0at heada6d6279a, using the live Fish Audio streaming path.~/.cue-cli/sessions/sid_398f2c3dd1e0/.