[pulseaudio-discuss] Best Case Latency

Patrick Shirkey pshirkey at boosthardware.com
Fri Sep 27 06:31:31 PDT 2013


On Fri, September 27, 2013 10:52 pm, Tanu Kaskinen wrote:
> On Fri, 2013-09-27 at 19:26 +1000, Patrick Shirkey wrote:
>> On Thu, September 26, 2013 2:27 am, Tanu Kaskinen wrote:
>> > Sorry, forgot to reply earlier. Yes, you can check the stream buffer
>> > with "pactl list sink-inputs". The "Buffer Latency" field shows the
>> > amount of audio in the stream buffer (not yet written to the sink).
>> The
>> > "Sink Latency" field shows the latency of the sink. The sum of these
>> two
>> > values is the full server-side latency for the stream. In addition to
>> > the server-side latency, there's the transport latency between the
>> > client and the server (very low for local streams).
>> >
>>
>> Thanks for that info. Polling the output I see the results fluctuate
>> over
>> time in much the same way that the results from jack_iodelay fluctuate.
>> I
>> haven't tried to correlate them yet but here's a snapshot to give you a
>> better idea of what is happening on this machine.
>
> The latency stays around 10 ms. You complained earlier that the latency
> would grow to several hundreds of milliseconds, but this shows no such
> behaviour, so the problem is somewhere else than in the playback stream
> inside pulseaudio.
>

It may seem like I am complaining but I am not trying to come across that
way. I am trying to get hard data on the real world latency performance
using the combination of JACK + PA to allow a bunch of people including
some of your colleagues at Intel to attempt to make a professional
business decision about the best way to integrate them (or not) for mobile
platforms. IMO it is best to run them with the method that I am testing
and fix any issues that might not have been ironed out yet but others are
suggesting they should be used interchangeably. That opens up a can of
works that may be a lot more effort to implement both in terms of
resources and politically for various reasons so I am reluctant to follow
that path unless all options with combining JACK + PA have been
categorically shown to be infeasible or impractical (or both).

At the moment I'm trying to pin down the cause of the consistent and
reproducible but fluctuating latency results that I see with this machine.
I am doing this in order to get the hard data I need to present the JACK +
PA solution as the better method. So far I cannot point the finger at any
specific process or bottleneck. Given that I am apparently the only person
in the world who has the time and/or motivation to run these tests we are
working with the small dataset that I can provide. All your feedback is
crucial and very useful as I do not have the complete overview of PA
codebase like yourself or others on this list.

To recap, I have tested with two jack graphs.

1: jack_delay -> pa -> ecasound -> pa -> jack_delay

The latency starts low and then consistently climbs (see below).

2: jack_delay -> pa -> ecasound -> pa -> system_out -> system_in ->
jack_delay

The latency jumps around from anything between 4ms to 1300ms. It might
also go lower but I didn't see that yet.

- Here's an interesting snapshot for consideration captured just now while
running graph 1. The latency captured while polling with "pactl list
sink-inputs" is the same as the previous snapshot (approx 10ms).

ex.
	Buffer Latency: 8000 usec
	Sink Latency: 3166 usec

However, jack_delay reports the following data. Where you see ?? that
indicates a dropout in the audio stream so jack_delay was not able to make
a real measurement so guessed.

jack_delay -> pa -> ecasound -> pa -> jack_delay

---------------
62784.000 frames   1308.000 ms total roundtrip latency
	extra loopback latency: 62784 frames
	use 31392 for the backend arguments -I and -O
 62784.000 frames   1308.000 ms total roundtrip latency
	extra loopback latency: 62784 frames
	use 31392 for the backend arguments -I and -O ?? Inv
 63168.000 frames   1316.000 ms total roundtrip latency
	extra loopback latency: 63168 frames
	use 31584 for the backend arguments -I and -O
 63743.999 frames   1328.000 ms total roundtrip latency
	extra loopback latency: 63743 frames
	use 31871 for the backend arguments -I and -O
 64639.999 frames   1346.667 ms total roundtrip latency
	extra loopback latency: 64639 frames
	use 32319 for the backend arguments -I and -O
 64640.000 frames   1346.667 ms total roundtrip latency
	extra loopback latency: 64639 frames
	use 32319 for the backend arguments -I and -O
 64639.999 frames   1346.667 ms total roundtrip latency
	extra loopback latency: 64639 frames
	use 32319 for the backend arguments -I and -O
 64640.000 frames   1346.667 ms total roundtrip latency
	extra loopback latency: 64639 frames
	use 32319 for the backend arguments -I and -O
 64640.000 frames   1346.667 ms total roundtrip latency
	extra loopback latency: 64639 frames
	use 32319 for the backend arguments -I and -O
 64639.999 frames   1346.667 ms total roundtrip latency
	extra loopback latency: 64639 frames
	use 32319 for the backend arguments -I and -O
 64640.000 frames   1346.667 ms total roundtrip latency
	extra loopback latency: 64639 frames
	use 32319 for the backend arguments -I and -O
 64640.000 frames   1346.667 ms total roundtrip latency
	extra loopback latency: 64639 frames
	use 32319 for the backend arguments -I and -O
 64640.000 frames   1346.667 ms total roundtrip latency
	extra loopback latency: 64639 frames
	use 32319 for the backend arguments -I and -O
 65088.000 frames   1356.000 ms total roundtrip latency
	extra loopback latency: 65088 frames
	use 32544 for the backend arguments -I and -O
 65088.000 frames   1356.000 ms total roundtrip latency
	extra loopback latency: 65088 frames
	use 32544 for the backend arguments -I and -O
 65087.999 frames   1356.000 ms total roundtrip latency
	extra loopback latency: 65087 frames
	use 32543 for the backend arguments -I and -O
 65152.000 frames   1357.333 ms total roundtrip latency
	extra loopback latency: 65151 frames
	use 32575 for the backend arguments -I and -O
 65152.000 frames   1357.333 ms total roundtrip latency
	extra loopback latency: 65151 frames
	use 32575 for the backend arguments -I and -O
 65152.000 frames   1357.333 ms total roundtrip latency
	extra loopback latency: 65152 frames
	use 32576 for the backend arguments -I and -O
 65152.000 frames   1357.333 ms total roundtrip latency
	extra loopback latency: 65151 frames
	use 32575 for the backend arguments -I and -O
 65216.000 frames   1358.667 ms total roundtrip latency
	extra loopback latency: 65216 frames
	use 32608 for the backend arguments -I and -O
    64.000 frames      1.333 ms total roundtrip latency
	extra loopback latency: 63 frames
	use 31 for the backend arguments -I and -O
    64.000 frames      1.333 ms total roundtrip latency
	extra loopback latency: 63 frames
	use 31 for the backend arguments -I and -O ?? Inv
   256.000 frames      5.333 ms total roundtrip latency
	extra loopback latency: 256 frames
	use 128 for the backend arguments -I and -O
   256.000 frames      5.333 ms total roundtrip latency
	extra loopback latency: 256 frames
	use 128 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 640 frames
	use 320 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 640 frames
	use 320 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 639 frames
	use 319 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 640 frames
	use 320 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 640 frames
	use 320 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 639 frames
	use 319 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 639 frames
	use 319 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 639 frames
	use 319 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 640 frames
	use 320 for the backend arguments -I and -O
   640.000 frames     13.333 ms total roundtrip latency
	extra loopback latency: 640 frames
	use 320 for the backend arguments -I and -O
   768.001 frames     16.000 ms total roundtrip latency
	extra loopback latency: 768 frames
	use 384 for the backend arguments -I and -O
   832.000 frames     17.333 ms total roundtrip latency
	extra loopback latency: 832 frames
	use 416 for the backend arguments -I and -O
   832.000 frames     17.333 ms total roundtrip latency
	extra loopback latency: 832 frames
	use 416 for the backend arguments -I and -O
   832.000 frames     17.333 ms total roundtrip latency
	extra loopback latency: 831 frames
	use 415 for the backend arguments -I and -O
   832.000 frames     17.333 ms total roundtrip latency
	extra loopback latency: 832 frames
	use 416 for the backend arguments -I and -O
  1024.000 frames     21.333 ms total roundtrip latency
	extra loopback latency: 1024 frames
	use 512 for the backend arguments -I and -O ??
  1024.000 frames     21.333 ms total roundtrip latency
	extra loopback latency: 1024 frames
	use 512 for the backend arguments -I and -O
  1024.000 frames     21.333 ms total roundtrip latency
	extra loopback latency: 1023 frames
	use 511 for the backend arguments -I and -O
  1024.000 frames     21.333 ms total roundtrip latency
	extra loopback latency: 1023 frames
	use 511 for the backend arguments -I and -O


---------------


--
Patrick Shirkey
Boost Hardware Ltd


More information about the pulseaudio-discuss mailing list