force max 8 seconds of buffer for YT music
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 27 Jul 2022 17:02:53 +0000 (19:02 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 27 Jul 2022 17:02:53 +0000 (19:02 +0200)
music_assistant/controllers/streams.py

index cf7bf76f307c5216e85cded4bbce21f2b20a1b66..26769f3d3d2ee1ba742395dae8c851b49138f644 100644 (file)
@@ -637,7 +637,9 @@ 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 use_crossfade and buffered_ahead > (crossfade_duration * 4):
+                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