Skip to content

Instantly share code, notes, and snippets.

@dasl-
Created November 12, 2022 02:31
Show Gist options
  • Save dasl-/3561ef8f598d9750f675c42789a32a53 to your computer and use it in GitHub Desktop.
Save dasl-/3561ef8f598d9750f675c42789a32a53 to your computer and use it in GitHub Desktop.
diff --git a/audio_alsa.c b/audio_alsa.c
index 62db843f..9cb9cd5d 100644
--- a/audio_alsa.c
+++ b/audio_alsa.c
@@ -1889,6 +1889,12 @@ static int play(void *buf, int samples, __attribute__((unused)) int sample_type,
__attribute__((unused)) uint32_t timestamp,
__attribute__((unused)) uint64_t playtime) {
+ if (sample_type == play_samples_are_timed) {
+ int64_t lead_time = playtime - get_absolute_time_in_ns();
+ debug(2, "leadtime for frame %u is %" PRId64 " nanoseconds, i.e. %f seconds. Playtime: %" PRId64, timestamp,
+ lead_time, 0.000000001 * lead_time, playtime);
+ }
+
// play() will change the state of the alsa_backend_mode to abm_playing
// also, if the present alsa_backend_state is abm_disconnected, then first the
// DAC must be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment