fix(smallwebrtc): suppress timeout warnings when tracks are disabled

This commit is contained in:
Om Chauhan
2026-01-01 22:00:08 +05:30
parent 7b595f10ce
commit 700a94222b
2 changed files with 11 additions and 2 deletions

View File

@@ -0,0 +1 @@
- Updated `read_audio_frame` & `read_video_frame` methods in `SmallWebRTCClient` to check if the track is enabled before logging a warning.

View File

@@ -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: