[pulseaudio-discuss] source-sink loopback

pl bossart bossart.nospam at gmail.com
Wed Aug 19 21:57:47 PDT 2009


Thanks Lennart for your comments.

> pa_memchunk is a structure that is just a short way to store a pointer
> plus and index and a size. You can allocate it on the stack or
> wherever you want, but it's your job to allocate it, and how you do it
> is up to you. Seldomly you'd malloc() it explcitly however. More
> likely it is simply a part of some other struct or on the stack. It is
> not ref counted or anything. It's just a quicker way of passing around
> this triplet of data.
>
> That means that the create_memchunk() code is really not
> necessary. You don't need to explicitly allocate a memblock into
> it. As soon as you have a memchunk from the source just copy that
> struct verbatim and you are fine.

Got it. This is really due to the way I developed the code. I started
from module-sine and realized that the length of the chunk defined the
pop() timing. I really wanted to have push and pop fire at the same
time to understand PA timing internals and minimize the need for
queuing. For the push(), the timing depends on the source latency but
for the pop() this depends on the chunk size, not on the sink latency.
However when I connected the two with the memblockq, I did not realize
that the memblock allocation done in create_memchunk() became useless.
Even worse the code in pa_memblockq_peek() removes the link to this
initial memblock. I guess it must be reclaimed since it's not
referenced by anyone...
Thanks for the heads-up on this one.

> You could compare the use of "memchunk" a bit with "extents" in file
> system speak.
I speak DSP, French and English, und ein bisschen Deutsch, but no
hablo file systemo :-(
Servus,
- Pierre



More information about the pulseaudio-discuss mailing list