<div dir="ltr"><div>Hi Abrar,</div><div><br></div><div>With autoaudiosrc and autoaudiosink, the pipeline will automatically plug appropriate elements with default configuration. For instance on my system this is what it looks like:</div><div><br></div><div>$ gst-launch-1.0 autoaudiosrc ! audiolatency print-latency=true ! autoaudiosink<br></div><div>[...]<br></div><div>last latency: 7ms, running average: 7ms<br>last latency: 190ms, running average: 99ms<br>last latency: 178ms, running average: 125ms<br>last latency: 195ms, running average: 143ms<br>last latency: 172ms, running average: 149ms<br>last latency: 194ms, running average: 186ms<br>last latency: 195ms, running average: 187ms<br>last latency: 188ms, running average: 189ms<br>last latency: 190ms, running average: 188ms<br></div><div><br></div><div>If we directly use the elements auto-plugged by autoaudiosrc / autoaudiosink, we get the same latency:</div><div><br></div><div>$ gst-launch-1.0 pulsesrc  ! audiolatency print-latency=true ! pulsesink </div><div>[...]<br>last latency: 191ms, running average: 191ms<br>last latency: 189ms, running average: 190ms<br>last latency: 204ms, running average: 195ms<br>last latency: 190ms, running average: 194ms<br>last latency: 182ms, running average: 191ms<br>last latency: 180ms, running average: 189ms<br>last latency: 176ms, running average: 186ms</div><div><br></div><div>But if we tweak the appropriate properties, the latency goes down:</div><div><br></div><div>$ gst-launch-1.0 pulsesrc buffer-time=20000 latency-time=10000 ! audiolatency print-latency=true ! pulsesink buffer-time=20000 latency-time=10000<br>last latency: 14ms, running average: 14ms<br>last latency: 60ms, running average: 37ms<br>last latency: 58ms, running average: 44ms<br>last latency: 58ms, running average: 48ms<br>last latency: 52ms, running average: 48ms<br>last latency: 52ms, running average: 56ms</div><div><br></div><div>buffer-time and latency-time control parameters for the audio ringbuffer. buffer-time is the total size of the ringbuffer (max-latency) and latency-time is the size of each read / write to that ringbuffer (min-latency). The lowest possible values depend on the audio hardware, audio drivers, sound server, real-time priority of the app, available CPU, etc.</div><div><br></div><div>You will get the lowest latency with pipewire or JACK on Linux, wasapi2 or ASIO on Windows, and CoreAudio (osxaudiosrc / sink) on macOS.</div><div><br></div><div>With wasapi, wasapi2, and jack you can set low-latency=true to ask the element to auto-configure to a low latency value.<br></div><div><br></div><div>Cheers,</div><div>Nirbheek<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 23, 2022 at 3:30 PM Abrar Shahriar via gstreamer-devel <<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I have been using audiolatency with some custom Gst apps, it usually shows 40-50ms, but when using the sample cmd line pipeline (
<div style="margin-top:1em;margin-bottom:1em;font-family:cantarell,sans-serif;font-size:medium;background-color:rgb(255,255,255)">
<table style="border:1px solid rgba(114,159,207,0.2)">
<tbody>
<tr>
<td style="margin-top:0px;margin-bottom:0px;padding:0.5em;background:rgba(114,159,207,0.1) none repeat scroll 0% 0%">
<pre style="background:rgba(0,0,0,0) none repeat scroll 0% 0%;border:0px none;margin:0px">gst<span>-</span>launch<span>-</span><span style="color:rgb(85,87,83)">1.0</span> <span>-</span>v autoaudiosrc <span>!</span> audiolatency print<span>-</span>latency<span>=</span><span style="color:rgb(78,154,6)">true</span> <span>!</span> autoaudiosink</pre>
</td>
</tr>
</tbody>
</table>
</div>
<br>
), it shows around 200-300ms.<br>
<br>
I made a custom app mirroring the sample pipeline, this app also shows 200-300ms. </div>
<div style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:12pt;color:rgb(0,0,0)">
There is usually a big jump after the first print like so-</div>
<blockquote style="border-color:rgb(200,200,200);border-left:3px solid rgb(200,200,200);padding-left:1ex;margin-left:0.8ex;color:rgb(102,102,102)">
<div style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:12pt;color:rgb(0,0,0)">
last latency: 44ms, running average: 44ms
<div>last latency: 1025ms, running average: 535ms</div>
<div>last latency: 175ms, running average: 415ms</div>
<div>last latency: 215ms, running average: 365ms</div>
<div>last latency: 173ms, running average: 326ms</div>
</div>
</blockquote>
<div><span style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:12pt;color:rgb(0,0,0)">​What is the mechanism behind this? Is there a way to constantly get 40-50ms?</span><br>
</div>
<div>
<div style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="gmail-m_7570242831710983193Signature">
<div>
<div style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:12pt;color:rgb(0,0,0)">
</div>
<div><font face="Yu Gothic, 游ゴシック, YuGothic, sans-serif" color="#201f1e"><span style="font-size:14.6667px">-Abrar</span></font></div>
<div><font face="Yu Gothic, 游ゴシック, YuGothic, sans-serif" color="#201f1e"><span style="font-size:14.6667px"><br>
</span></font></div>
<div><span style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:15px">ーーーーーーーーー</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<p style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background:white none repeat scroll 0% 0%">
<span style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;color:rgb(32,31,30)" lang="JA"><span style="font-size:15px;text-align:start;background-color:rgb(255,255,255);display:inline"><span style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:14.6667px;text-align:left;background-color:rgb(255,255,255);display:inline">アブラル・ザヒン<span style="background-color:rgb(255,255,255);display:inline">・</span><span style="background-color:rgb(255,255,255);display:inline">シャハリアル<span> </span></span></span></span><span style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:15px;text-align:start;background-color:rgb(255,255,255);display:inline">
 (Abrar Zahin Shahriar</span><span style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:15px;text-align:start;background-color:rgb(255,255,255);display:inline">)</span><br style="font-size:15px;text-align:start;background-color:rgb(255,255,255)">
<br style="font-size:15px;text-align:start;background-color:rgb(255,255,255)">
<span style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:15px;text-align:start;background-color:rgb(255,255,255);display:inline">ハイパーダイン株式会社</span><br style="font-size:15px;text-align:start;background-color:rgb(255,255,255)">
<span style="font-family:"Yu Gothic",游ゴシック,YuGothic,sans-serif;font-size:15px;text-align:start;background-color:rgb(255,255,255);display:inline">〒108-0014 東京都港区芝5丁目9-12 3階</span><br>
</span></p>
</div>
</div>
</div>
</div>
</div>

</blockquote></div>