From: Marcel van der Veldt Date: Fri, 8 Jul 2022 00:05:20 +0000 (+0200) Subject: set buffer to 1 second X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=8d65c866c6c50d13128dcc710d8f89581bbc7a56;p=music-assistant-server.git set buffer to 1 second --- diff --git a/music_assistant/controllers/streams.py b/music_assistant/controllers/streams.py index 987a3051..5e7b3107 100644 --- a/music_assistant/controllers/streams.py +++ b/music_assistant/controllers/streams.py @@ -349,7 +349,6 @@ class QueueStream: self.pcm_sample_rate, self.pcm_bit_depth, self.pcm_channels, - 0.1, ) self._runner_task: Optional[asyncio.Task] = None self._prev_chunk: bytes = b"" @@ -603,7 +602,6 @@ class QueueStream: self.pcm_sample_rate, self.pcm_bit_depth, self.pcm_channels, - 1, ) # buffer size is duration of crossfade + 3 seconds crossfade_duration = self.queue.settings.crossfade_duration or fade_in or 1 @@ -727,8 +725,8 @@ class QueueStream: if use_crossfade: # crossfade is enabled, save fadeout part to pickup for next track - last_part = last_part[-buf_size:] - remaining_bytes = last_part[:-buf_size] + last_part = last_part[-crossfade_size:] + remaining_bytes = last_part[:-crossfade_size] # yield remaining bytes bytes_written += len(remaining_bytes) yield remaining_bytes diff --git a/music_assistant/helpers/audio.py b/music_assistant/helpers/audio.py index 1a6ad224..6bc9d76f 100644 --- a/music_assistant/helpers/audio.py +++ b/music_assistant/helpers/audio.py @@ -673,7 +673,7 @@ def get_chunksize( sample_rate: int = 44100, bit_depth: int = 16, channels: int = 2, - seconds: float = 1.0, + seconds: int = 1, ) -> int: """Get a default chunksize for given contenttype.""" pcm_size = int(sample_rate * (bit_depth / 8) * channels * seconds)