From 44840c4a55a76ca6e264cf2295c594b31d637166 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 26 Sep 2019 15:17:00 +0200 Subject: [PATCH] alsa-seq: add some comments --- spa/plugins/alsa/alsa-seq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spa/plugins/alsa/alsa-seq.c b/spa/plugins/alsa/alsa-seq.c index 419beff65..f499f8bce 100644 --- a/spa/plugins/alsa/alsa-seq.c +++ b/spa/plugins/alsa/alsa-seq.c @@ -470,12 +470,15 @@ static int process_read(struct seq_state *state) data[2] = 0x40; } + /* queue_time is the estimated current time of the queue as calculated by + * the DLL. Calculate the age of the event. */ ev_time = SPA_TIMESPEC_TO_NSEC(&ev->time.time); if (state->queue_time > ev_time) diff = state->queue_time - ev_time; else diff = 0; + /* convert the age to samples and convert to an offset */ offset = (diff * state->rate.denom) / (state->rate.num * SPA_NSEC_PER_SEC); if (state->duration > offset) offset = state->duration - offset;