All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Max Schmidt <schmidti444@web.de>, alsa-devel@alsa-project.org
Subject: Re: Constant delay between starting a playback and a capture stream
Date: Sun, 29 Jun 2014 20:21:02 +0200	[thread overview]
Message-ID: <53B0590E.5010808@ladisch.de> (raw)
In-Reply-To: <trinity-f377e59a-71a6-447c-859a-f2188926e1f9-1403897243118@3capp-webde-bs11>

Max Schmidt wrote:
> I've got a BeagleBone Black (ARM Cortex A 8 µP) with an Audio-Cape
> (using McAsp and ALSA-Davinci-Drivers) and wrote an mmap based
> playback-capture application (both devices "hw:0,0"). The important
> thing is that the application needs a constant delay (not necessarily
> small) between the start of the playback and the capture stream.
> To realize that I use the ALSA API function "snd_pcm_link(c_handle,
> p_handle)".
>
> 1) Looking at a plot of multiple measurements of looped back and
> captured square waves (or sines) there still is a jitter of about two
> to four samples (at 48 kHz; which is about 40 to 80 ms), no matter if I
> run it as RT-app (energy save modes etc. disabled, just important
> Processes have a higher Priority e.g. EDMA) or normal app.
> Please correct me if I'm wrong, but as far as I understand when the
> streams are linked, at start the processor is going through a linked
> list triggering all linked streams. And the trigger start is an atomic
> process so shouldn't get interrupted.

Yes.

> Shouldn't it always take the same time between starting the playback
> and capture stream then? And if yes, where could the variable start
> delay come from?

Hardware accesses can be quite nondeterministic.  And if the driver is
not written properly, the start trigger will do all the DMA stream
initialization that should have been done when preparing the device.
(mcasp_start_tx() has a busy loop waiting for the device.)

There is hardware that actually supports starting two streams at exactly
the same time (by setting two bits in the same register).  Obviously,
this hardware or its driver doesn't support this.


Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2014-06-29 18:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <trinity-76c63013-83c5-446c-a160-bc9ed56a1161-1403540443117@3capp-webde-bs03>
2014-06-27 19:27 ` Constant delay between starting a playback and a capture stream Max Schmidt
2014-06-29 18:21   ` Clemens Ladisch [this message]
2014-06-30 23:32     ` Max Schmidt
2014-07-02 10:22 ` [Alsa-user] " Max Schmidt

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=53B0590E.5010808@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=schmidti444@web.de \
    /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.