All of lore.kernel.org
 help / color / mirror / Atom feed
* Calculated average playback latency
@ 2010-12-14 12:30 Jean-Yves Avenard
  2010-12-14 16:20 ` Clemens Ladisch
  0 siblings, 1 reply; 2+ messages in thread
From: Jean-Yves Avenard @ 2010-12-14 12:30 UTC (permalink / raw)
  To: alsa-devel

Hi there.

I am involved in maintaining the mythtv audio code.

Today one of our user complained that he couldn't get any audio out ,
even though everything was properly configured on his side.

By default, Myth uses mmap access ; unless we found out that the audio
device doesn't allow mmap (e.g. snd_pcm_hw_params_set_access(handle,
params, SND_PCM_ACCESS_MMAP_INTERLEAVED) errored)

Problem, turned out his was using a USB audio device, and
snd_pcm_hw_params_set_access didn't return any error.

It's not the first time we're having such issues, so I decided to stop
using mmap and instead use snd_pcm_writei.

Now on my system, this has added quite a bit of latency and the A/V
sync isn't perfect anymore...

Is there an official way to calculate an average system latency
(doesn't need to be perfectly accurate).

I couldn't find obvious references on how to perform such task.

I find some references in program like mplayer or jack using
snd_pcm_status_get_trigger_tstamp

Would anyone be kind enough to point me to some documentation or
explain to me how I could calculate the average latency between the
time you start playback and the time sounds actually comes out.

Thank you in advance
Jean-Yves

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Calculated average playback latency
  2010-12-14 12:30 Calculated average playback latency Jean-Yves Avenard
@ 2010-12-14 16:20 ` Clemens Ladisch
  0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2010-12-14 16:20 UTC (permalink / raw)
  To: Jean-Yves Avenard; +Cc: alsa-devel

Jean-Yves Avenard wrote:
> By default, Myth uses mmap access

Why?

> Problem, turned out his was using a USB audio device, and
> snd_pcm_hw_params_set_access didn't return any error.

USB audio devices do support mmap.

> ... I decided to stop using mmap and instead use snd_pcm_writei.
> 
> Now on my system, this has added quite a bit of latency and the A/V
> sync isn't perfect anymore...

Using mmap neither reduces latency, nor does it improve synchronization.

> Is there an official way to calculate an average system latency
> (doesn't need to be perfectly accurate).

Not the average, but try snd_pcm_delay().


Regards,
Clemens

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-12-14 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-14 12:30 Calculated average playback latency Jean-Yves Avenard
2010-12-14 16:20 ` Clemens Ladisch

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.