From dc8483db14dece7e3853723d07476c0b8736931d Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Sun, 17 Feb 2019 13:23:34 +0000 Subject: [PATCH] try using CLOCK_REALTIME -- a bad hack --- audio_alsa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/audio_alsa.c b/audio_alsa.c index 484d6a237..2b8d20458 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -114,7 +114,7 @@ int frame_size; // in bytes for interleaved stereo int alsa_device_initialised; // boolean to ensure the initialisation is only // done once snd_pcm_t *alsa_handle = NULL; -int alsa_uses_monolithic_clock; +int alsa_uses_monotonic_clock = 0; static snd_pcm_hw_params_t *alsa_params = NULL; static snd_pcm_sw_params_t *alsa_swparams = NULL; static snd_ctl_t *ctl = NULL; @@ -459,8 +459,8 @@ int actual_open_alsa_device(void) { return ret; } - alsa_uses_monolithic_clock = snd_pcm_hw_params_is_monotonic (alsa_params); - debug(1,"alsa does%s use CLOCK_MONOLITHIC",alsa_uses_monolithic_clock ? "" : " not"); + alsa_uses_monotonic_clock = snd_pcm_hw_params_is_monotonic(alsa_params); + debug(1,"alsa_uses_monotonic_clock is %d",alsa_uses_monotonic_clock); debug (1,"sizeof time_t is: %d.", sizeof(time_t)); debug (1,"sizeof long is: %d.", sizeof(long)); @@ -1158,7 +1158,7 @@ int delay_and_status(snd_pcm_state_t *state, snd_pcm_sframes_t *delay) { if (*state == SND_PCM_STATE_DRAINING) debug(1, "alsa: draining with a delay of %d.", delay); - clock_gettime(CLOCK_MONOTONIC, &tn); + clock_gettime(CLOCK_REALTIME, &tn); uint64_t time_now_ns = tn.tv_sec * (uint64_t)1000000000 + tn.tv_nsec; uint64_t update_timestamp_ns = update_timestamp.tv_sec * (uint64_t)1000000000 + update_timestamp.tv_nsec;