diff --git a/src/outputs/alsa.c b/src/outputs/alsa.c index fb545f46..0005e5c3 100644 --- a/src/outputs/alsa.c +++ b/src/outputs/alsa.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -741,7 +742,7 @@ sync_check(double *drift, double *latency, struct alsa_playback_session *pb, snd // Set *latency to the "average" within the period *latency = (*drift) * alsa_latency_history_size / 2 + (*latency); - if (abs(*latency) < ALSA_MAX_LATENCY && abs(*drift) < ALSA_MAX_DRIFT) + if (fabs(*latency) < ALSA_MAX_LATENCY && fabs(*drift) < ALSA_MAX_DRIFT) sync = ALSA_SYNC_OK; // If both latency and drift are within thresholds -> no action else if (*latency > 0 && *drift > 0) sync = ALSA_SYNC_AHEAD;