Mentioning the fix in the changelog.
This commit is contained in:
@@ -42,6 +42,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Fixed
|
### 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
|
- Fixed an issue in `AsyncAITTSService`, where `TTSTextFrames` were not being
|
||||||
pushed.
|
pushed.
|
||||||
|
|
||||||
|
|||||||
@@ -161,22 +161,9 @@ class SmallWebRTCTrack:
|
|||||||
|
|
||||||
async def _idle_watcher(self):
|
async def _idle_watcher(self):
|
||||||
"""Disable receiving if idle for more than _idle_timeout and monitor queue size."""
|
"""Disable receiving if idle for more than _idle_timeout and monitor queue size."""
|
||||||
last_warned_queue_size = 0
|
|
||||||
|
|
||||||
while self._receiver._enabled:
|
while self._receiver._enabled:
|
||||||
await asyncio.sleep(self._idle_timeout)
|
await asyncio.sleep(self._idle_timeout)
|
||||||
idle_duration = time.time() - self._last_recv_time
|
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:
|
if idle_duration >= self._idle_timeout:
|
||||||
# discard old frames to prevent memory growth
|
# discard old frames to prevent memory growth
|
||||||
logger.debug(
|
logger.debug(
|
||||||
|
|||||||
Reference in New Issue
Block a user