Skip to content

fix: unblock avatar audio after lost stream trailer - #7043

Open
mikemikimike wants to merge 2 commits into
livekit:mainfrom
mikemikimike:fix/7008-unblock-lost-audio-stream
Open

fix: unblock avatar audio after lost stream trailer#7043
mikemikimike wants to merge 2 commits into
livekit:mainfrom
mikemikimike:fix/7008-unblock-lost-audio-stream

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

Summary

When an avatar audio stream loses its trailer, DataStreamAudioReceiver can remain blocked on that reader forever even after later audio streams arrive. This change closes the stale reader when a subsequent stream is received, allowing the receiver to emit the pending segment end and process queued audio.

Testing

  • uv run --package livekit-agents --with pytest python -m pytest tests/test_datastream_io.py -q
  • uv run --package livekit-agents ruff check livekit-agents/livekit/agents/voice/avatar/_datastream_io.py tests/test_datastream_io.py
  • git diff --check

@mikemikimike
mikemikimike requested a review from a team as a code owner August 30, 2026 05:59
devin-ai-integration[bot]

This comment was marked as resolved.

@mikemikimike

Copy link
Copy Markdown
Contributor Author

Thanks for catching this. Fixed in 0a74af3 by closing the last queued reader when a new stream arrives, while preserving the active-reader fallback. Added a regression test covering an active reader followed by a queued reader and a new stream. Local ruff, format, and diff checks pass; the focused pytest dependency sync was blocked by slow wheel downloads, so CI is being used for the full test verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant