All of lore.kernel.org
 help / color / mirror / Atom feed
* ASoC: TLV320AIC3x how to reduce alsa playback/capture latency?
@ 2016-03-24 11:12 Timur Karaldin
  0 siblings, 0 replies; only message in thread
From: Timur Karaldin @ 2016-03-24 11:12 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org; +Cc: Peter Ujfalusi

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-24 11:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 11:12 ASoC: TLV320AIC3x how to reduce alsa playback/capture latency? Timur Karaldin

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.