diff --git a/changelog/3336.changed.md b/changelog/3336.changed.md new file mode 100644 index 000000000..2f6a28b30 --- /dev/null +++ b/changelog/3336.changed.md @@ -0,0 +1 @@ +- Updated `read_audio_frame` & `read_video_frame` methods in `SmallWebRTCClient` to check if the track is enabled before logging a warning. \ No newline at end of file diff --git a/src/pipecat/transports/smallwebrtc/transport.py b/src/pipecat/transports/smallwebrtc/transport.py index 0e2ea544e..c0b77c1ef 100644 --- a/src/pipecat/transports/smallwebrtc/transport.py +++ b/src/pipecat/transports/smallwebrtc/transport.py @@ -304,7 +304,11 @@ class SmallWebRTCClient: try: frame = await asyncio.wait_for(video_track.recv(), timeout=2.0) except asyncio.TimeoutError: - if self._webrtc_connection.is_connected(): + if ( + self._webrtc_connection.is_connected() + and video_track + and video_track.is_enabled() + ): logger.warning("Timeout: No video frame received within the specified time.") # self._webrtc_connection.ask_to_renegotiate() frame = None @@ -354,7 +358,11 @@ class SmallWebRTCClient: try: frame = await asyncio.wait_for(self._audio_input_track.recv(), timeout=2.0) except asyncio.TimeoutError: - if self._webrtc_connection.is_connected(): + if ( + self._webrtc_connection.is_connected() + and self._audio_input_track + and self._audio_input_track.is_enabled() + ): logger.warning("Timeout: No audio frame received within the specified time.") frame = None except MediaStreamError: