<div dir="ltr"><div><span style="font-size:16px">> </span>Tanu wrote:</div><span style="font-size:16px">> You can check with "pactl list source-outputs" how big the "buffer</span><br style="font-size:16px"><span style="font-size:16px">> latency" of your recording stream is. If it's small, then I don't think</span><br style="font-size:16px"><span style="font-size:16px">> the problem is in your application.</span><br><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px">Hi, thank you for your answer. Buffer latency and source latency have a value of 0 usec:</span></div><div><span style="font-size:16px"><br></span></div><div><div><span style="font-size:16px">Source Output #2</span></div><div><span style="font-size:16px"><span style="white-space:pre"> </span>Driver: protocol-native.c</span></div><div><span style="font-size:16px"><span style="white-space:pre">   </span>Owner Module: 12</span></div><div><span style="font-size:16px"><span style="white-space:pre">    </span>Client: 12</span></div><div><span style="font-size:16px"><span style="white-space:pre">  </span>Source: 2</span></div><div><span style="font-size:16px"><span style="white-space:pre">   </span>Sample Specification: float32le 2ch 44100Hz</span></div><div><span style="font-size:16px"><span style="white-space:pre"> </span>Channel Map: front-left,front-right</span></div><div><span style="font-size:16px"><span style="white-space:pre"> </span>Format: pcm, format.sample_format = "\"float32le\""  format.rate = "44100"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""</span></div><div><span style="font-size:16px"><span style="white-space:pre"> </span>Corked: no</span></div><div><span style="font-size:16px"><span style="white-space:pre">  </span>Mute: no</span></div><div><span style="font-size:16px"><span style="white-space:pre">    </span>Volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB</span></div><div><span style="font-size:16px"><span style="white-space:pre">  </span>        balance 0,00</span></div><div><span style="font-size:16px"><span style="white-space:pre">    </span>Buffer Latency: 0 usec</span></div><div><span style="font-size:16px"><span style="white-space:pre">      </span>Source Latency: 0 usec</span></div><div><span style="font-size:16px"><span style="white-space:pre">      </span>Resample method: n/a</span></div><div><span style="font-size:16px"><span style="white-space:pre">        </span>Properties:</span></div><div><span style="font-size:16px"><span style="white-space:pre">         </span><a href="http://media.name">media.name</a> = "Record Stream"</span></div><div><span style="font-size:16px"><span style="white-space:pre">                </span><a href="http://application.name">application.name</a> = "PulseEffects"</span></div><div><span style="font-size:16px"><span style="white-space:pre">             </span>native-protocol.peer = "UNIX socket client"</span></div><div><span style="font-size:16px"><span style="white-space:pre">               </span>native-protocol.version = "32"</span></div><div><span style="font-size:16px"><span style="white-space:pre">            </span>media.role = "production"</span></div><div><span style="font-size:16px"><span style="white-space:pre">         </span>application.icon_name = "pulseeffects"</span></div><div><span style="font-size:16px"><span style="white-space:pre">            </span><a href="http://application.process.id">application.process.id</a> = "1797"</span></div><div><span style="font-size:16px"><span style="white-space:pre">         </span>application.process.user = "wallace"</span></div><div><span style="font-size:16px"><span style="white-space:pre">              </span>application.process.host = "wwmm"</span></div><div><span style="font-size:16px"><span style="white-space:pre">         </span>application.process.binary = "python3.6"</span></div><div><span style="font-size:16px"><span style="white-space:pre">          </span>application.language = "en_US.UTF-8"</span></div><div><span style="font-size:16px"><span style="white-space:pre">              </span>window.x11.display = ":1"</span></div><div><span style="font-size:16px"><span style="white-space:pre">         </span>application.process.machine_id = "767c0755fd35486daf42d8e1a6d41540"</span></div><div><span style="font-size:16px"><span style="white-space:pre">               </span>application.process.session_id = "c3"</span></div><div><span style="font-size:16px"><span style="white-space:pre">             </span><a href="http://module-stream-restore.id">module-stream-restore.id</a> = "source-output-by-media-role:production"</span></div></div><div><span style="font-size:16px"><br></span></div><div><span style="font-size:16px">I wonder if this problem could be related to the alsa driver. This </span>ALC887-VD sound card is in a ryzen motherboard (asus prime B350m-a). As this is a new hardware maybe something is not right at the driver level. I am using kernel 4.11.6 and Pulseaudio 10 in Arch Linux. I have been suffering with random cracklings that come and go after shutdown/poweron also at random (tsched=0 does not help). When they happen I can listen to them even if using speaker-test to play a sine wave directly to an alsa device. So it does not seems that Pulseaudio is the one responsible for this crackling. But I do not know how to pinpoint the exact cause of this problem.</div><div><span style="font-size:16px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 27, 2017 at 11:12 AM, Tanu Kaskinen <span dir="ltr"><<a href="mailto:tanuk@iki.fi" target="_blank">tanuk@iki.fi</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sun, 2017-06-25 at 16:14 -0300, wellington wallace wrote:<br>
> Hi,<br>
><br>
> Today I noticed I have lots of these messages in Pulseaudio debug output:<br>
><br>
> jun 25 15:44:11 wwmm pulseaudio[1148]: D: [alsa-sink-ALC887-VD Analog]<br>
> ratelimit.c: 1685 events suppressed<br>
> jun 25 15:44:11 wwmm pulseaudio[1148]: D: [alsa-sink-ALC887-VD Analog]<br>
> memblock.c: Pool full<br>
> jun 25 15:44:11 wwmm pulseaudio[1148]: D: [null-sink] memblock.c: Pool full<br>
><br>
> They happen when I am using my application<br>
> <a href="https://github.com/wwmm/pulseeffects" rel="noreferrer" target="_blank">https://github.com/wwmm/<wbr>pulseeffects</a>. In PulseEffects I load a null sink<br>
> and then launch a gstreamer pipeline where the pulsesrc plugin records from<br>
> the null sink monitor device. I wonder if I am doing something wrong. It<br>
> seems to me that these messages should not be there when everything is<br>
> alright. Is that so?<br>
<br>
</span>If the mempool is full, then all memblocks from the pool are in use,<br>
and pulseaudio has to use malloc() to allocate new blocks. Either the<br>
pool is just too small for the use case, or something is leaking (i.e.<br>
not releasing) memblocks.<br>
<br>
Applications don't interface with the mempool directly, but if a<br>
recording application doesn't consume the audio that the server sends,<br>
then memblocks will be queued in the stream buffer (usually up to 4MB).<br>
This could cause shortage in the mempool, especially if the configured<br>
latency is low, because in that case the blocks are reserved at a<br>
higher rate. I don't know how else this could be the application's<br>
fault.<br>
<br>
You can check with "pactl list source-outputs" how big the "buffer<br>
latency" of your recording stream is. If it's small, then I don't think<br>
the problem is in your application.<br>
<span class=""><br>
> As someone new to the development of Pulseaudio applications I would also<br>
> like to ask what is the proper when to finish an application that is using<br>
> Pulseaudio. The documentation tells to disconnect from the context and I am<br>
> already doing that. Is there something else I should do when closing the<br>
> application? Like calling unref on context?<br>
<br>
</span>Yes, you need to call unref on all objects that your application is<br>
holding a reference to, and that includes the context object.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Tanu<br>
<br>
<a href="https://www.patreon.com/tanuk" rel="noreferrer" target="_blank">https://www.patreon.com/tanuk</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Prof.° Wellington Wallace Miguel Melo<br><br><div>CEFET/RJ Uned Nova Iguaçu<br><br></div></div></div>
</div>