Support the new stateful AudioStreamTrack from getstream#612
Conversation
- pass final=True to `audio_track.write()` to flush the resampler - use stateful resampling in Avatars, LocalEdge and TencentEdge - extra: add close timeout for Anam to prevent hanging when the call ends
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAudio output handling now propagates bare final markers to drain buffered resampler tails. Local, LemonSlice, LiveAvatar, Tencent, and Anam audio paths use persistent frame resamplers and flush them at turn, interruption, or segment boundaries. Tests cover channel-shaped PCM input, resampler buffering, final-tail draining, and bare final markers. The getstream dependency range was updated to version 4.1 through version 5. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
plugins/tencent/Dockerfile (1)
5-5: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winAvoid installing recommended packages.
Add
--no-install-recommendsto keep the Tencent image smaller and reduce unnecessary dependencies and attack surface.Proposed fix
- && apt-get upgrade -y && apt-get install -y git && rm -rf /var/lib/apt/lists/* + && apt-get upgrade -y && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*Source: Linters/SAST tools
tests/test_agents/test_agents.py (1)
251-253: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse a docstring instead of inline comments.
Convert the inline comments to a docstring to remain consistent with other tests in this file and follow the project's coding guidelines.
Proposed fix
- # A bare end-of-turn marker (AudioOutputChunk with final=True but no data) - # must drain the output track's resampler tail, so the utterance plays out - # further than when no marker follows the audio. + """ + A bare end-of-turn marker (AudioOutputChunk with final=True but no data) + must drain the output track's resampler tail, so the utterance plays out + further than when no marker follows the audio. + """Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 72eef82b-7743-46fe-b332-ebd040f008b1
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
agents-core/vision_agents/core/agents/agents.pyplugins/anam/vision_agents/plugins/anam/anam_avatar.pyplugins/lemonslice/vision_agents/plugins/lemonslice/lemonslice_rtc_manager.pyplugins/liveavatar/vision_agents/plugins/liveavatar/liveavatar_websocket.pyplugins/local/tests/test_tracks.pyplugins/local/vision_agents/plugins/local/tracks.pyplugins/tencent/Dockerfileplugins/tencent/tests/test_tracks.pyplugins/tencent/vision_agents/plugins/tencent/tracks.pytests/test_agents/test_agents.py
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 91e49c3a-641a-46ab-83e2-aa08c3b37afe
📒 Files selected for processing (1)
plugins/tencent/Dockerfile
Why
Stateful resampler provides better audio quality with fewer hisses and artifacts.
Changes
audio_track.write()to flush the resamplergetstreamrequirement to v4.1.0+