Skip to content

Support the new stateful AudioStreamTrack from getstream#612

Merged
dangusev merged 8 commits into
mainfrom
feat/support-new-audiostreamtrack
Jul 18, 2026
Merged

Support the new stateful AudioStreamTrack from getstream#612
dangusev merged 8 commits into
mainfrom
feat/support-new-audiostreamtrack

Conversation

@dangusev

@dangusev dangusev commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Why

Stateful resampler provides better audio quality with fewer hisses and artifacts.

Changes

  • 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
  • Updated getstream requirement to v4.1.0+

- 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
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e860c33f-2871-410d-8b73-d91132f0b1c0

📥 Commits

Reviewing files that changed from the base of the PR and between a1e2c57 and 417555e.

📒 Files selected for processing (1)
  • plugins/anam/vision_agents/plugins/anam/anam_avatar.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins/anam/vision_agents/plugins/anam/anam_avatar.py

📝 Walkthrough

Walkthrough

Audio 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🧹 Nitpick comments (2)
plugins/tencent/Dockerfile (1)

5-5: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Avoid installing recommended packages.

Add --no-install-recommends to 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 value

Use 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

📥 Commits

Reviewing files that changed from the base of the PR and between 634c357 and 599c507.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • agents-core/vision_agents/core/agents/agents.py
  • plugins/anam/vision_agents/plugins/anam/anam_avatar.py
  • plugins/lemonslice/vision_agents/plugins/lemonslice/lemonslice_rtc_manager.py
  • plugins/liveavatar/vision_agents/plugins/liveavatar/liveavatar_websocket.py
  • plugins/local/tests/test_tracks.py
  • plugins/local/vision_agents/plugins/local/tracks.py
  • plugins/tencent/Dockerfile
  • plugins/tencent/tests/test_tracks.py
  • plugins/tencent/vision_agents/plugins/tencent/tracks.py
  • tests/test_agents/test_agents.py

Comment thread plugins/anam/vision_agents/plugins/anam/anam_avatar.py
Comment thread plugins/anam/vision_agents/plugins/anam/anam_avatar.py
Comment thread plugins/tencent/tests/test_tracks.py
Comment thread plugins/tencent/vision_agents/plugins/tencent/tracks.py
Comment thread plugins/anam/vision_agents/plugins/anam/anam_avatar.py
Comment thread plugins/tencent/Dockerfile Outdated
@dangusev
dangusev marked this pull request as ready for review July 18, 2026 09:16

@coderabbitai coderabbitai 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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e9cdad8 and 322d782.

📒 Files selected for processing (1)
  • plugins/tencent/Dockerfile

Comment thread plugins/tencent/Dockerfile Outdated
@dangusev
dangusev merged commit 8ba620a into main Jul 18, 2026
14 checks passed
@dangusev
dangusev deleted the feat/support-new-audiostreamtrack branch July 18, 2026 11:07
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