Skip to content

livekit-plugins-fishaudio: drop startup prebuffer#2033

Merged
toubatbrian merged 2 commits into
mainfrom
tweedy-damson-whiles
Jul 15, 2026
Merged

livekit-plugins-fishaudio: drop startup prebuffer#2033
toubatbrian merged 2 commits into
mainfrom
tweedy-damson-whiles

Conversation

@rosetta-livekit-bot

@rosetta-livekit-bot rosetta-livekit-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Port livekit/agents#6423 for Fish Audio streaming startup latency.

  • emit Fish Audio websocket audio frames as soon as they are decoded instead of holding one back at startup
  • keep terminal flush frames marked final when present
  • add a patch changeset for @livekit/agents-plugin-fishaudio

Verification

  • pnpm --filter @livekit/agents-plugin-fishaudio... build
  • pnpm test -- plugins/fishaudio (credentialed integration test skipped because Fish/OpenAI keys are not configured)
  • pnpm --filter @livekit/agents-plugin-fishaudio lint
Source diff coverage
Source file Classification Target coverage
livekit-plugins/livekit-plugins-fishaudio/livekit/plugins/fishaudio/tts.py Adapted Ported to plugins/fishaudio/src/tts.ts. The Python source removed _PREBUFFER_CHUNKS, the push_audio startup chunk accumulator, and flush_prebuffer, then pushed Fish audio events directly. The JS target did not have the same two-chunk Fish message prebuffer, but it did hold back one decoded AudioFrame to tag final; this PR removes that startup emission delay by queueing decoded audio frames immediately and only marking frames from the terminal flush as final when 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):

  • origin (api.fish.audio, n=150): median 402ms, min 223ms, 0 underruns
  • livekit inference gateway (n=25): median 398ms, min 387ms, 0 underruns

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

  • Credentialed voice-mode session: sid_398f2c3dd1e0 at head a6d6279a, using the live Fish Audio streaming path.
  • Persisted boundary events prove the first complete SDK frame was emitted 2.465 ms after Fish audio event 1 and 47.427 ms before Fish audio event 2, directly distinguishing the new behavior from the removed retained-frame path.
  • The session resolved successfully and persisted events plus full-session and per-command WAV recordings under ~/.cue-cli/sessions/sid_398f2c3dd1e0/.

@rosetta-livekit-bot rosetta-livekit-bot Bot requested a review from a team as a code owner July 14, 2026 18:32
@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a6d6279

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
@livekit/agents-plugin-fishaudio Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-anthropic Patch
@livekit/agents-plugin-assemblyai Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-cerebras Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-did Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-hume Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-liveavatar Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-minimax Patch
@livekit/agents-plugin-mistral Patch
@livekit/agents-plugin-mistralai Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-perplexity Patch
@livekit/agents-plugin-phonic Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-runway Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-soniox Patch
@livekit/agents-plugin-tavus Patch
@livekit/agents-plugin-trugen Patch
@livekit/agents-plugin-xai Patch
@livekit/agents-plugins-test Patch

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Co-authored-by: Cursor <cursoragent@cursor.com>
@toubatbrian toubatbrian merged commit ed4f14f into main Jul 15, 2026
8 checks passed
@toubatbrian toubatbrian deleted the tweedy-damson-whiles branch July 15, 2026 00:13
@github-actions github-actions Bot mentioned this pull request Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant