From 0e533d21be49676c42c93efb3ec3df97384a71f5 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Mon, 4 Aug 2025 10:52:30 -0300 Subject: [PATCH 1/2] Only send audio and video from the tavus video service if the transport is ready. --- src/pipecat/services/tavus/video.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pipecat/services/tavus/video.py b/src/pipecat/services/tavus/video.py index f9ba2833b..37b21257f 100644 --- a/src/pipecat/services/tavus/video.py +++ b/src/pipecat/services/tavus/video.py @@ -24,6 +24,7 @@ from pipecat.frames.frames import ( Frame, OutputAudioRawFrame, OutputImageRawFrame, + OutputTransportReadyFrame, StartFrame, StartInterruptionFrame, TTSAudioRawFrame, @@ -81,6 +82,7 @@ class TavusVideoService(AIService): self._send_task: Optional[asyncio.Task] = None # This is the custom track destination expected by Tavus self._transport_destination: Optional[str] = "stream" + self._transport_ready = False async def setup(self, setup: FrameProcessorSetup): """Set up the Tavus video service. @@ -145,7 +147,8 @@ class TavusVideoService(AIService): format=video_frame.color_format, ) frame.transport_source = video_source - await self.push_frame(frame) + if self._transport_ready: + await self.push_frame(frame) async def _on_participant_audio_data( self, participant_id: str, audio: AudioData, audio_source: str @@ -157,7 +160,8 @@ class TavusVideoService(AIService): num_channels=audio.num_channels, ) frame.transport_source = audio_source - await self.push_frame(frame) + if self._transport_ready: + await self.push_frame(frame) def can_generate_metrics(self) -> bool: """Check if this service can generate processing metrics. @@ -221,6 +225,9 @@ class TavusVideoService(AIService): await self.push_frame(frame, direction) elif isinstance(frame, TTSAudioRawFrame): await self._handle_audio_frame(frame) + elif isinstance(frame, OutputTransportReadyFrame): + self._transport_ready = True + await self.push_frame(frame, direction) else: await self.push_frame(frame, direction) From c22866ed58bbcb169963e28c5123dc25fd999b1c Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Mon, 4 Aug 2025 11:46:24 -0300 Subject: [PATCH 2/2] Mentioning the TavusVideoService fix in the changelog. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af91cb43d..969d63c5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated `daily-python` to 0.19.6. +- Changed `TavusVideoService` to send audio or video frames only after the + transport is ready, preventing warning messages at startup. + ### Fixed - Fixed an issue in `LiveKitTransport` where empty `AudioRawFrame`s were pushed