* pcm: add a loop to snd_pcm_avail_delay() to avoid bogus delay values [not found] <alsa-project/alsa-lib/pr/469@alsa-project.org> @ 2025-07-31 13:00 ` GitHub pull_request - opened 0 siblings, 0 replies; only message in thread From: GitHub pull_request - opened @ 2025-07-31 13:00 UTC (permalink / raw) To: alsa-devel alsa-project/alsa-lib pull request #469 was opened from kv2019i: 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/issues/468 Request URL : https://github.com/alsa-project/alsa-lib/pull/469 Patch URL : https://github.com/alsa-project/alsa-lib/pull/469.patch Repository URL: https://github.com/alsa-project/alsa-lib ^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-31 13:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <alsa-project/alsa-lib/pr/469@alsa-project.org>
2025-07-31 13:00 ` pcm: add a loop to snd_pcm_avail_delay() to avoid bogus delay values GitHub pull_request - opened
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).