I have an agent to save all audio in a room. When...
# ask-ai
b
I have an agent to save all audio in a room. When there are only two other participants, one user and one agent, I see messages like this in the logs, and want to know how to fix them: WARNINGlivekitlibwebrtc:👿audio stream233libwebrtc👿:audio_stream - native audio stream queue overflow; dropped 1 queued frames
✅ 1
t
Thanks for reaching out, Mat. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I see you're hitting the libwebrtc warning about "native audio stream queue overflow" when the agent and one user are in the room. That message means audio frames are being produced faster than your consumer code is processing them, so the bounded audio-frame queue fills and older frames are dropped. You can fix this by either increasing the buffer or making your consumer faster: • Increase the queue size (recommended). When creating the audio stream, raise
queue_size_frames
from the small default (usually ~10) to something larger (for example 50):
Copy code
audio_stream = rtc.AudioStream.from_track(
      track=track,
      sample_rate=48000,
      num_channels=1,
      queue_size_frames=50
  )
• Make your audio processing loop consume frames without blocking (process frames immediately, avoid long synchronous ops inside the loop). • If you accept variable memory usage and latency, set
queue_size_frames=0
to use an unbounded queue (caution: may grow memory). If you want, tell me: • which SDK/language you're using, • your current
queue_size_frames
(if set), • and a short snippet of how you process frames — and I’ll suggest specific values or code changes. Sources: libwebrtc/src/native/audio_stream.rs, with interactive elements