Mentioning the fix in the changelog.

This commit is contained in:
Filipi Fuchter
2025-09-18 18:43:33 -03:00
parent 93a89449b8
commit 766e1948a6
2 changed files with 5 additions and 13 deletions

View File

@@ -42,6 +42,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed a memory leak in `SmallWebRTCTransport`. In `aiortc`, when you receive
a `MediaStreamTrack` (audio or video), frames are produced asynchronously. If
the code never consumes these frames, they are queued in memory, causing a
memory leak.
- Fixed an issue in `AsyncAITTSService`, where `TTSTextFrames` were not being
pushed.

View File

@@ -161,22 +161,9 @@ class SmallWebRTCTrack:
async def _idle_watcher(self):
"""Disable receiving if idle for more than _idle_timeout and monitor queue size."""
last_warned_queue_size = 0
while self._receiver._enabled:
await asyncio.sleep(self._idle_timeout)
idle_duration = time.time() - self._last_recv_time
if isinstance(self._track, RemoteStreamTrack) and hasattr(self._track, "_queue"):
queue_size = self._track._queue.qsize()
# Show warning each time queue grows 10 frames beyond last warning
if queue_size >= last_warned_queue_size + 10:
logger.warning(
f"{self._track.kind} track queue size is high: {queue_size} frames"
)
last_warned_queue_size = queue_size
if idle_duration >= self._idle_timeout:
# discard old frames to prevent memory growth
logger.debug(