From 94e1059ac96257f19655d8403d9791978f1fbc9d Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Mon, 10 Mar 2025 16:11:06 +0100 Subject: [PATCH] Chore: limit cache filling a bit more to keep cpu to a minimum on super fast connections, rate limit the cache fill a bit more --- music_assistant/helpers/audio.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/music_assistant/helpers/audio.py b/music_assistant/helpers/audio.py index 8bce0578..185642d3 100644 --- a/music_assistant/helpers/audio.py +++ b/music_assistant/helpers/audio.py @@ -157,8 +157,10 @@ class StreamCache: audio_input=audio_source, input_format=self.streamdetails.audio_format, output_format=self.streamdetails.audio_format, - extra_input_args=extra_input_args, chunk_size=64000, + # apply readrate limiting to avoid buffering too much data too fast + # so we only allow reading into the cache max 5 times the normal speed + extra_input_args=["-readrate", "5", *extra_input_args], ): async with self._lock: self._data += chunk -- 2.34.1