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

Clemens Ladisch clemens at ladisch.de
Fri Dec 23 21:51:47 CET 2016


Jan Deinhard wrote:
>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."

The trigger/current timestamps are not related to the buffer/queue.
They are useful only to relate the audio stream position to the
system time.

>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?

They are the same. ALSA returns it to prevent your process from being
interrupted between measuring the two clocks.


Regards,
Clemens



More information about the Alsa-devel mailing list