All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Danzberger <daniel@dd-wrt.com>
To: alsa-devel@alsa-project.org
Subject: out of sync capture samples with MMAP on MIPS
Date: Wed, 23 May 2018 20:36:37 +0200	[thread overview]
Message-ID: <e89758e0-b3db-c17c-71f5-e7acfbe76845@dd-wrt.com> (raw)

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

             reply	other threads:[~2018-05-23 18:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-23 18:36 Daniel Danzberger [this message]
2018-05-25 12:20 ` out of sync capture samples with MMAP on MIPS Takashi Iwai
2018-05-25 12:24   ` Takashi Iwai
2018-05-27  9:34   ` Daniel Danzberger
2018-05-27 11:08     ` Takashi Iwai
2018-05-29  7:55       ` Daniel Danzberger
2018-05-29  8:02         ` Takashi Iwai
2018-05-27 11:17   ` Daniel Danzberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e89758e0-b3db-c17c-71f5-e7acfbe76845@dd-wrt.com \
    --to=daniel@dd-wrt.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.