mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
[alsa] Fix incorrect use of abs() for float, use fabs() instead
This commit is contained in:
parent
6836a0f277
commit
e654276262
@ -28,6 +28,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
|
||||||
@ -741,7 +742,7 @@ sync_check(double *drift, double *latency, struct alsa_playback_session *pb, snd
|
|||||||
// Set *latency to the "average" within the period
|
// Set *latency to the "average" within the period
|
||||||
*latency = (*drift) * alsa_latency_history_size / 2 + (*latency);
|
*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
|
sync = ALSA_SYNC_OK; // If both latency and drift are within thresholds -> no action
|
||||||
else if (*latency > 0 && *drift > 0)
|
else if (*latency > 0 && *drift > 0)
|
||||||
sync = ALSA_SYNC_AHEAD;
|
sync = ALSA_SYNC_AHEAD;
|
||||||
|
Loading…
Reference in New Issue
Block a user