cleanup
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 27 Jul 2022 18:00:12 +0000 (20:00 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 27 Jul 2022 18:00:12 +0000 (20:00 +0200)
music_assistant/controllers/streams.py

index 26769f3d3d2ee1ba742395dae8c851b49138f644..428d46001942513826a67e6ae37084b90bda82a5 100644 (file)
@@ -637,23 +637,11 @@ class QueueStream:
                 )
                 # use dynamic buffer size to account for slow connections (or throttling providers, like YT)
                 # buffer_duration has some overhead to account for padded silence
-                if streamdetails.provider == ProviderType.YTMUSIC:
-                    buffer_duration = min(crossfade_duration, 8)
-                elif use_crossfade and buffered_ahead > (crossfade_duration * 4):
-                    buffer_duration = crossfade_duration + 6
-                elif use_crossfade and buffered_ahead > (crossfade_duration * 2):
-                    buffer_duration = crossfade_duration + 4
-                else:
-                    buffer_duration = 2
-
-                # use dynamic buffer size to account for slow connections (or throttling providers, like YT)
-                # buffer_duration has some overhead to account for padded silence
+                padding = 0 if streamdetails.provider == ProviderType.YTMUSIC else 5
                 if use_crossfade and buffered_ahead > (crossfade_duration * 4):
-                    buffer_duration = crossfade_duration + 6
-                elif use_crossfade and buffered_ahead > (crossfade_duration * 2):
-                    buffer_duration = crossfade_duration + 4
+                    buffer_duration = crossfade_duration + padding
                 else:
-                    buffer_duration = 2
+                    buffer_duration = 1
 
                 ####  HANDLE FIRST PART OF TRACK