Re: Latency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



jon wrote:
> On Tue, 2013-04-09 at 21:59 +0200, Clemens Ladisch wrote:
>> jon wrote:
>>> If I increase the bufchunks value I seem to get larger latency
>>> yet the latency values i'm reading always seem to be the same.
>>
>> Apparently, your program fills the buffer fast enough so that there
>> are never too many frames available.  I'd guess that if your program
>> gets delayed more, by its own computations, by scheduling delays, or
>> by increasing the period time, you would see higher values.
>
> I'm not sure I understand that behaviour at all... I would expect ALSA
> to keep the buffer as full as possible not as empty ?

Please note that the number of "available" frames, as returned by
snd_pcm_avail(), is the number of sample that your application can write
to the buffer.  The number of frames available for the device to play is
the opposite of that.

> If I set the buffer length to say 100ms does ALSA not maintain a 100ms
> fill of the buffer only dropping if I don't send samples fast enough,
> then re-filling when I do - that is the behaviour I want (and would
> expect).

And that is exactly what happens.

> I am trying to cope with frequent short freezes (30ms or so) making
> buffer filling jittery. I want to maintain a cache of about 80ms between
> the ALSA write and my ears,

If that is what you call latency, then you must subtract the value
returned by snd_pcm_avail() from the buffer size.

> with ALSA using data from cache during the slower iterations of the
> fill loop. How can I do this ?

By using a buffer size of about 80 ms.


Regards,
Clemens

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user




[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux