[alsa-devel] How to keep track of the amount of queued samples?

Jan Deinhard jan.deinhard at gmail.com
Fri Dec 23 15:16:04 CET 2016


Hi,

I would like to understand the following quote which I copied from
https://www.kernel.org/doc/Documentation/sound/alsa/timestamping.txt

"The ALSA API provides two basic pieces of information, avail and delay,
which combined with the trigger and current system timestamps allow for
applications to keep track of the 'fullness' of the ring buffer and the
amount of queued samples."

Querying avail and delay is straight forward. But I have no idea how to use
these values in combination with trigger_htstamp and the current system
timestamp to calculate the fullness of the ring buffer.

Can someone provide some insight?

What exactly is meant by "current system timestamp"? Is it provied by ALSA
(htstamp?) or should I use clock_gettime(CLOCK_MONOTONIC, &system_time); to
get that timestamp?

Thanks,
Jan


More information about the Alsa-devel mailing list