[pulseaudio-discuss] Expand the simple API?

David Henningsson david.henningsson at canonical.com
Wed Mar 20 03:29:28 PDT 2013


(Please don't remove the list from CC. Re-added.)

On 03/20/2013 11:21 AM, Thomas Martitz wrote:
> Am 20.03.2013 10:06, schrieb David Henningsson:
>> Sure. You said "pa_simple_read/write() is expected to be done from the
>> main thread", but you meant more like "pa_simple_read/write() is
>> expected to be done from any other thread than the callback context"?
>>
>> A pa_simple callback API, if implemented, I would envision would
>> supply a data pointer and length, and ask for the callback function to
>> either read that out (record) or fill it in (playback), and to do so
>> without calling into the PulseAudio API at all.
>
> Or return a pointer (which is expected to point to a buffer of bytes
> length) in the playback case, to enable zero-copy?

The pointer sent to the callback function would be in SHM, shared memory 
between client and server, which is allocated by PulseAudio. That's the 
way to achieve zero-copy.
In the callback function you would generate your audio data straight 
into this buffer.

(Or one-copy, really, because there is a later copy from the shared 
memory into the DMA buffers of the sound card, which is done inside the 
PulseAudio daemon process.)


-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list