why does alsasink sync=false fix audio problems?

Charlie Laub charleslaub at sbcglobal.net
Sun Mar 4 19:01:14 UTC 2018


Nicolas, thank you for your reply. I discovered another solution to the dsnoop audio glitch problem that I wanted to share because it illuminates the magnitude of the dsnoop latency. 

 

I am using a pipeline that includes deinterleave and later audiointerleave so that I can access and modify the audio in individual channels. A simplistic example is this pipeline:

gst-launch-1.0 -vm alsasrc device=’dsnoop:CARD=Loopback,DEV=1’ ! deinterleave name=input   \

audiointerleave name=output ! alsasink device=’hw:CARD=PCH,DEV=0’ sync=false   \

input.src_0 ! output.sink_0   \

input.src_1 ! output.sink_1  \

The above pipeline still causes audio glitches/dropouts or freezes. 

 

The element audiointerleave has its own latency property that is used to accommodate various delays in the streams that are sinked to it. I found that if I set audiointerleave’s latency to 100 milliseconds (100000000) even when sync=true (the default of the sync property) the audio was also rendered without problems. The pipeline looks like this:

gst-launch-1.0 -vm alsasrc device=’dsnoop:CARD=Loopback,DEV=1’ ! deinterleave name=input   \

audiointerleave name=output latency=100000000 ! alsasink device=’hw:CARD=PCH,DEV=0’   \

input.src_0 ! output.sink_0   \

input.src_1 ! output.sink_1  \

 

My guess is that the additional latency of dsnoop is accommodated by the audiointerleave latency, meaning the dsnoop latency is between 10 and 100 milliseconds. 

 

Without increasing the audiointerleave latency, even when I set sync=false I was still experiencing stuttering audio. It seems that the first element in the pipeline that checks timing of buffers with respect to the pipeline clock and can drop buffers that are “too late” must have its parameters adjusted so that the dsnoop latency can be accommodated.

 

-Charlie

 

From: gstreamer-devel <gstreamer-devel-bounces at lists.freedesktop.org> On Behalf Of Nicolas Dufresne
Sent: Saturday, March 3, 2018 11:28 AM
To: Discussion of the development of and with GStreamer <gstreamer-devel at lists.freedesktop.org>
Subject: Re: why does alsasink sync=false fix audio problems?

 

 

Just like most alsa plugin, dsnoop does not broadcast the extra latency it is adding. As a side effect, all samples are submitted late and are dropped. Disabling the sync turns GST into a dummy audio filler. There is various settings you can play with that will improve this situation, have a look at latency and buffer-time on alsasrc/sink.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180304/eb948f2e/attachment.html>


More information about the gstreamer-devel mailing list