From b576380bdd3bcdf97d9a75eaa4e8df60f0365019 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Mon, 20 Jun 2022 09:38:28 +0200 Subject: [PATCH] Increase buffer size for radio streams (#379) --- music_assistant/controllers/streams.py | 6 +++--- music_assistant/helpers/process.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/music_assistant/controllers/streams.py b/music_assistant/controllers/streams.py index 7e715d17..f0767197 100644 --- a/music_assistant/controllers/streams.py +++ b/music_assistant/controllers/streams.py @@ -513,12 +513,12 @@ class QueueStream: sample_size = int( self.pcm_sample_rate * (self.pcm_bit_depth / 8) * self.pcm_channels - ) # 1 second - buffer_size = sample_size * (self.queue.settings.crossfade_duration or 2) + ) + buffer_size = sample_size * (self.queue.settings.crossfade_duration or 5) # force small buffer for radio to prevent too much lag at start if queue_track.media_type != MediaType.TRACK: use_crossfade = False - buffer_size = sample_size + buffer_size = sample_size * 2 self.logger.info( "Start Streaming queue track: %s (%s) for queue %s", diff --git a/music_assistant/helpers/process.py b/music_assistant/helpers/process.py index b368a28d..a556a9d7 100644 --- a/music_assistant/helpers/process.py +++ b/music_assistant/helpers/process.py @@ -52,7 +52,7 @@ class AsyncProcess: stdin=asyncio.subprocess.PIPE if self._enable_stdin else None, stdout=asyncio.subprocess.PIPE if self._enable_stdout else None, stderr=asyncio.subprocess.PIPE if self._enable_stderr else None, - limit=self.chunk_size * 5, + limit=self.chunk_size * 15, close_fds=True, ) else: @@ -61,7 +61,7 @@ class AsyncProcess: stdin=asyncio.subprocess.PIPE if self._enable_stdin else None, stdout=asyncio.subprocess.PIPE if self._enable_stdout else None, stderr=asyncio.subprocess.PIPE if self._enable_stderr else None, - limit=self.chunk_size * 5, + limit=self.chunk_size * 15, close_fds=True, ) return self -- 2.34.1