The Advanced Linux Sound Architecture (ALSA) - library
Find a file
Kai Vehmanen 5f524e3004 pcm: add a loop to snd_pcm_avail_delay() to avoid bogus delay values
snd_pcm_avail_delay() is expected to report avail and delay values
in atomic fashion. However the function does two separate syscalls
and it cannot guarantee the avail value is the same as was used
to calculate the delay. This is a problem as the reported delay is
always relative to avail frames value.

If application (like e.g. alsa_conformance_test) uses snd_pcm_avail_delay()
to estimate the effective play position, it can observe bogus delay
values (and effective play position going backwards) if
snd_pcm_avail_delay() is called during a DMA burst where hw_ptr
moves quickly.

This commit adds a loop similar to that used in snd_pcm_hw_htimestamp()
to wait until we get a stable avail reading, and only then extract
the delay. This will avoid bogus values if function is called during
DMA bursts.

Closes: https://github.com/alsa-project/alsa-lib/pull/469
Closes: https://github.com/alsa-project/alsa-lib/issues/468
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2025-07-31 15:25:18 +02:00
.github/workflows github: fix Fedora workflow (awk package dependency) 2025-04-24 15:16:12 +02:00
aserver aserver: fix buffer overwriting 2023-12-11 09:20:06 +01:00
doc doc: fix permissions 2025-02-02 21:51:25 +01:00
include add snd_strlcat() function 2025-04-14 18:41:42 +02:00
m4 Fix symver build error on non-ELF platforms 2023-09-01 16:54:44 +02:00
modules mixer: simple module: python 3.10 PyTuple_SET_ITEM() fix 2022-05-20 10:03:10 +02:00
src pcm: add a loop to snd_pcm_avail_delay() to avoid bogus delay values 2025-07-31 15:25:18 +02:00
test test/playmidi1: fix compilation caused by conflict between midifile.h and ump_msg.h 2025-02-02 19:22:05 +01:00
utils utils: add missing alsa-topology.pc.in to EXTRA_DIST 2025-02-03 11:54:12 +01:00
.gitignore Delete alsalisp code 2025-04-07 18:36:54 +02:00
acinclude.m4 fixed for the recent autoconf. 2004-01-26 15:52:17 +00:00
ChangeLog * update to libtool 1.3.3 1999-07-22 12:18:42 +00:00
configure.ac Release v1.2.14 2025-04-14 18:42:04 +02:00
COPYING Change FSF address (Franklin Street) 2017-11-14 14:29:26 +01:00
gitcompile Delete alsalisp code 2025-04-07 18:36:54 +02:00
INSTALL pcm: Add thread-safety to PCM API 2016-07-11 15:25:30 +02:00
Makefile.am Delete alsalisp code 2025-04-07 18:36:54 +02:00
MEMORY-LEAK Initial version 2003-02-04 14:56:07 +00:00
NOTES Change assert condition in error message handler 2007-10-24 12:53:08 +02:00
README.md README: Add link to GitHub Actions 2022-05-19 12:47:24 +02:00
TODO Added snd_config_load_override(). 2002-01-09 21:28:15 +00:00

alsa-lib

Advanced Linux Sound Architecture (ALSA) project

Build alsa-lib

The alsa-lib is a library to interface with ALSA in the Linux kernel and virtual devices using a plugin system.

The up-to-date reference generated from sources can be accessed here:

http://www.alsa-project.org/alsa-doc/alsa-lib/

You may give a look for more information about the ALSA project to URL http://www.alsa-project.org.

Submitting patches

The preferred way to submit patches is by sending them by email to the alsa-devel mailing list. Sending mail to the list requires subscription, subscribe here: https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Add Takashi Iwai <tiwai@suse.de> and/or Jaroslav Kysela <perex@perex.cz> to Cc so that your patch won't be missed.

Patches are also accepted as GitHub pull requests.