All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Karaldin <karaldin@mcsplus.ru>
To: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
Subject: ASoC: TLV320AIC3x how to reduce alsa playback/capture latency?
Date: Thu, 24 Mar 2016 14:12:15 +0300	[thread overview]
Message-ID: <56F3CB8F.8020109@mcsplus.ru> (raw)

Hello,
I have an issue to reduce playback/capture audio latency for AIC3106.
Now I'm using following strategy for initial of alsa backend driver in 
user level application:

snd_pcm_hw_params_set_period_size(...,frame_size,...);
snd_pcm_hw_params_set_periods_min(...,&periodsp,...);
if(periodsp< user_nperiods)
	periodsp = user_nperiods
snd_pcm_hw_params_set_periods_near(....,&periodsp,...);
snd_pcm_hw_set_buffer_size(...,frame_size*periodsp,....);
[...]
snd_pcm_sw_params_set_start_threshold(..., 0U);
snd_pcm_sw_params_set_stop_threshold(..., frame_size*periodsp);
if(playback)
{
	availmin=frame_size*(periodsp-user_nperiods+1);

}else
{
	availmin=frame_size;
}
snd_pcm_sw_params_set_avail_min(...,availmin)
[...]

On far end I hear an echo with delay about 1 second, I definitely know 
that it is a playback/capture (acoustic echo), and delay is too much for 
any AEC because of (as I think) low latency in alsa driver or 
misunderstanding how it should be initialized. I already exclude other 
delays (jitter delay, network delay)

My initial parameters: frame_size = 640, rate = 16000, user_nperiods = 
2, but after calling snd_pcm_hw_params_set_periods_min I got minimum 
periodsp = 16.
For these parameter buffer (16 buffers 40ms each) total length of buffer 
is 0.64 sec.

My question is how could I reduce this latency? May be some improvements 
which allow me to set up less then 16 buffers, or I did wrong 
initialization or is there any another internal buffer which make such 
long delay for echo?

Cheers,
Tim Karaldin

                 reply	other threads:[~2016-03-24 11:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=56F3CB8F.8020109@mcsplus.ru \
    --to=karaldin@mcsplus.ru \
    --cc=alsa-devel@alsa-project.org \
    --cc=peter.ujfalusi@ti.com \
    /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.