From 93d8ddf4f276341cb0fd1b984448e29b9aeb4af5 Mon Sep 17 00:00:00 2001 From: Filipi Fuchter Date: Wed, 12 Mar 2025 15:13:59 -0300 Subject: [PATCH] Only showing the timout warning to receive frame if the client is connected. --- src/pipecat/transports/network/small_webrtc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pipecat/transports/network/small_webrtc.py b/src/pipecat/transports/network/small_webrtc.py index 9dbbd0f5d..d99813a77 100644 --- a/src/pipecat/transports/network/small_webrtc.py +++ b/src/pipecat/transports/network/small_webrtc.py @@ -187,9 +187,10 @@ class SmallWebRTCClient: try: frame = await asyncio.wait_for(self._video_input_track.recv(), timeout=1.0) except asyncio.TimeoutError: - logger.warning("Timeout: No video frame received within the specified time.") + if self._webrtcConnection.is_connected(): + logger.warning("Timeout: No video frame received within the specified time.") + self._webrtcConnection.ask_to_renegotiate() frame = None - self._webrtcConnection.ask_to_renegotiate() if frame is None or not isinstance(frame, VideoFrame): # If no valid frame, sleep for a bit @@ -233,7 +234,8 @@ class SmallWebRTCClient: try: frame = await asyncio.wait_for(self._audio_input_track.recv(), timeout=1.0) except asyncio.TimeoutError: - logger.warning("Timeout: No audio frame received within the specified time.") + if self._webrtcConnection.is_connected(): + logger.warning("Timeout: No audio frame received within the specified time.") frame = None if frame is None or not isinstance(frame, AudioFrame):