[alsa-devel] out of sync capture samples with MMAP on MIPS

Daniel Danzberger daniel at dd-wrt.com
Wed May 23 20:36:37 CEST 2018


I am using alsa's mmap() interface to capture audio samples on some AR71xx MIPS
devices via USB and sometimes the sampled audio sounds very disordered.

After debugging deeper into this issue I found that samples are fine in the
kernel's vmalloc'ed buffer (runtime->dma_area). But once they get accessed from
userspace via mmaped memory, the samples differ.

I wrote a module + userspace program to demonstrate the issue:
git at github.com:dddaniel/mmaptest.git

The userspace tool reads the data a couple of times with a small delay.
As you see below, after a couple of reads the data gets closer to look like in
the kernel buffer:
---
root at OpenWrt:/# mmaptest-user
mmap addr: 0x77a04000
[  760.464968] mmap page 7573000 at va 87573000
check memory ...FAIL (at byte 0)
check memory ...FAIL (at byte 96)
check memory ...FAIL (at byte 96)
check memory ...FAIL (at byte 96)
check memory ...FAIL (at byte 128)
---

Does someone here experienced similar issues ?


More information about the Alsa-devel mailing list