[pulseaudio-discuss] Best Case Latency

Patrick Shirkey pshirkey at boosthardware.com
Fri Sep 27 02:26:18 PDT 2013


On Thu, September 26, 2013 2:27 am, Tanu Kaskinen wrote:
> On Wed, 2013-09-25 at 23:35 +1000, Patrick Shirkey wrote:
>> On Tue, September 24, 2013 10:33 pm, Patrick Shirkey wrote:
>> >
>> > On Mon, September 23, 2013 6:11 pm, Tanu Kaskinen wrote:
>> >> The audio is accumulating in some buffer, and the JACK sink in
>> >> PulseAudio doesn't have any buffer, so it's not the sink. It could be
>> >> some other buffer in PulseAudio, or it could be a buffer in ecasound.
>> >>
>> >> Saying that ecasound is configured with 64 frames/period isn't
>> terribly
>> >> informative, because I don't know how ecasound handles the transfer
>> from
>> >> the input to the output. Does it push the data immediately to the
>> output
>> >> when it gets something from the input, or are both directions
>> callback
>> >> based? If the former, then the data can accumulate in the stream
>> buffer
>> >> in PA, and if the latter, then there has to be an intermediate buffer
>> >> between the input and the output in ecasound, and the data can
>> >> accumulate there.
>> >>
>> >
>> > I've asked for some more details on the ecasound list.
>> >
>> > If the PA stream buffer is kicking in, Is there any way I can verify
>> if it
>> > is happening? is there anything I can do to minimise that affect?
>> >
>>
>> I had verification from the ecasound developer Kai Vehmanen that
>> ecasound
>> does not have an internal buffer that could be affecting the latency in
>> this way. It just buffers 64 frames and if it can't keep up it will drop
>> data and report an underun. In my tests there were just a few underruns
>> over several hours so it appears safe to rule out ecasound.
>>
>> Does anyone have any suggestions for testing the PA Stream Buffer to
>> check
>> if it is a bottleneck in my test environment?
>
> 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.

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

	Buffer Latency: 6666 usec
	Sink Latency: 3229 usec
--
	Buffer Latency: 5333 usec
	Sink Latency: 3791 usec
--
	Buffer Latency: 5333 usec
	Sink Latency: 3479 usec
--
	Buffer Latency: 5333 usec
	Sink Latency: 3791 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3666 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 2791 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 2791 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3041 usec
--
	Buffer Latency: 5333 usec
	Sink Latency: 3479 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 2958 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3375 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 2833 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3187 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 2937 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 2958 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 2708 usec
--
	Buffer Latency: 4000 usec
	Sink Latency: 2687 usec
--
	Buffer Latency: 5333 usec
	Sink Latency: 3500 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 3437 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3645 usec
--
	Buffer Latency: 4000 usec
	Sink Latency: 3000 usec
--
	Buffer Latency: 5333 usec
	Sink Latency: 3666 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 3041 usec
--
	Buffer Latency: 2666 usec
	Sink Latency: 3416 usec
--
	Buffer Latency: 4000 usec
	Sink Latency: 2625 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 3375 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 2791 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 2750 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3083 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3333 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3604 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3166 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3520 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 2895 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3395 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3083 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 2937 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3604 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 3250 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 2687 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 3166 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3687 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3250 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3062 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3729 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3729 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 2895 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3395 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 3041 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 2708 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3187 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3250 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3770 usec
--
	Buffer Latency: 4000 usec
	Sink Latency: 3687 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3041 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3437 usec
--
	Buffer Latency: 8000 usec
	Sink Latency: 3020 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3166 usec
--
	Buffer Latency: 0 usec
	Sink Latency: 2916 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3333 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3250 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3062 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3520 usec
--
	Buffer Latency: 6666 usec
	Sink Latency: 3625 usec


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


---------------
Sample Output
---------------
Sink Input #1
	Driver: protocol-native.c
	Owner Module: 9
	Client: 5
	Sink: 0
	Sample Specification: s32le 2ch 48000Hz
	Channel Map: front-left,front-right
	Format: pcm, format.sample_format = "\"s32le\""  format.rate = "48000" 
format.channels = "2"  format.channel_map = "\"front-left,front-right\""
	Mute: no
	Volume: 0: 100% 1: 100%
	        0: 0.00 dB 1: 0.00 dB
	        balance 0.00
	Buffer Latency: 6666 usec
	Sink Latency: 3625 usec
	Resample method: copy
	Properties:
		media.name = "ALSA Playback"
		application.name = "ALSA plug-in [ecasound]"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "26"
		application.process.id = "29246"
		application.process.user = "xxx"
		application.process.host = "xxx"
		application.process.binary = "ecasound"
		application.language = "C"
		window.x11.display = ":0"
		application.process.machine_id = "041faf23ca9cf5b3380f10bb508e20d3"
		application.process.session_id =
"041faf23ca9cf5b3380f10bb508e20d3-1380185886.55549-100083828"
		module-stream-restore.id = "sink-input-by-application-name:ALSA plug-in
[ecasound]"

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


--
Patrick Shirkey
Boost Hardware Ltd


More information about the pulseaudio-discuss mailing list