You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clear queued playback audio on WebRTC backend (barge-in) (#1186)
* feat(media): clear queued playback audio on WebRTC backend (barge-in)
GstWebRTCClient.clear_output_buffer() was a no-op, so realtime
conversation barge-in could not stop already-buffered robot speech.
Add a real clear_player() to GstWebRTCClient that flushes the local
audio send chain and POSTs /api/media/clear_incoming_audio so the
daemon also flushes its incoming-audio playback pipeline (where most
of the buffered audio actually sits). Deprecate clear_output_buffer()
on both the WebRTC and local GStreamer backends (warn-only).
Wire the daemon flush through both transports: a new REST endpoint and
a ClearIncomingAudioCmd data-channel command, both routed to
Backend.clear_incoming_audio() -> GstMediaServer.clear_incoming_audio().
Flush the incoming-audio appsrc with reset_time=False to keep the
shared-clock timeline intact. Expose clearIncomingAudio() in the
TypeScript SDK and document it.
Fixes#1108
Assisted-by: Claude:claude-opus-4-8
* refactor(media): make clear_player() part of the AudioBase contract
Promote clear_player() to an abstract method on AudioBase now that both
GStreamerAudio and GstWebRTCClient implement it, so callers can invoke
it without hasattr() guards. Tidy the deprecated clear_output_buffer()
docstrings to imperative mood (ruff D401).
Assisted-by: Claude:claude-opus-4-8
* regenerate api
* feat(webrtc): continuous audio send chain via audiomixer
Insert an audiomixer (fed by a silent live audiotestsrc on a second pad)
into the WebRTC audio send chain so it emits a continuous output stream
between utterances, keeping the Opus encoder / webrtcbin warm. This drops
the 0.5 s warm-up-silence hack and the first-word swallowing it worked
around. A capsfilter after the mixer pins the output to SAMPLE_RATE /
CHANNELS so opusenc/rtpopuspay advertise sprop-maxcapturerate and stereo
encoding-params matching the negotiated webrtcbin OPUS sink pad (the
mixer otherwise defaults to 48 kHz / mono and webrtcbin rejects it).
Push path now marks the first buffer of a cue DISCONT with a running-time
PTS and leaves follow-up buffers untimestamped, letting the mixer place
them contiguously by byte offset. Handle LATENCY bus messages to
redistribute latency after the live elements are added dynamically.
Assisted-by: Claude:claude-opus-4-8
* removing extra latency on the mixer
Copy file name to clipboardExpand all lines: docs/source/API/openapi.json
+23Lines changed: 23 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1314,6 +1314,29 @@
1314
1314
}
1315
1315
}
1316
1316
},
1317
+
"/api/media/clear_incoming_audio": {
1318
+
"post": {
1319
+
"summary": "Clear Incoming Audio",
1320
+
"description": "Drop audio received from WebRTC clients that is queued for the speaker.\n\nUsed for barge-in so the robot stops speaking already-buffered audio.",
0 commit comments