From 9d3485225ef537af2a8e7a7ff0160edd7f9fe48b Mon Sep 17 00:00:00 2001 From: Piotr Mamak Date: Fri, 16 May 2025 11:00:25 +0200 Subject: [PATCH] Improve sync stability by adapting to diff trend shifts (#2189) --- music_assistant/providers/squeezelite/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/music_assistant/providers/squeezelite/__init__.py b/music_assistant/providers/squeezelite/__init__.py index c315929d..e80537c5 100644 --- a/music_assistant/providers/squeezelite/__init__.py +++ b/music_assistant/providers/squeezelite/__init__.py @@ -759,16 +759,16 @@ class SlimprotoProvider(PlayerProvider): - self._get_corrected_elapsed_milliseconds(slimplayer) ) + sync_playpoints.append(SyncPlayPoint(now, sync_master.player_id, diff)) + # ignore unexpected spikes if ( sync_playpoints - and abs(statistics.fmean(x.diff for x in sync_playpoints)) > DEVIATION_JUMP_IGNORE + and abs(statistics.fmean(abs(x.diff) for x in sync_playpoints) - abs(diff)) + > DEVIATION_JUMP_IGNORE ): return - # we can now append the current playpoint to our list - sync_playpoints.append(SyncPlayPoint(now, sync_master.player_id, diff)) - min_req_playpoints = 2 if sync_master.elapsed_seconds < 2 else MIN_REQ_PLAYPOINTS if len(sync_playpoints) < min_req_playpoints: return -- 2.34.1