[pulseaudio-discuss] Question wrt recording

Lennart Poettering lennart at poettering.net
Thu Mar 19 06:01:13 PDT 2009

On Tue, 10.03.09 21:56, Magnus Hjorth (magnus.hjorth at home.se) wrote:

> Hi,
> According to the docs for libpulse, pa_stream_set_overflow_callback is  
> only for playback streams. So, how can you get notified of overflow in  
> recording streams? Or does PA  dynamically allocate larger buffers so  
> overflows never can happen?

The buffer management in PA is based on ref counting. That means when
the queue is empty it doesn't take up any memory. And if it is not
empty it takes exactly as much memory as its current fill level. We
still enforce some limit to this, but generally overflows when
recording are unlikely.

That said it probably makes sense to throw overflow events for
recording as well -- which we indeed currently don't do.

> Another question, is there a way to query for a source if there is any  
> on-the-fly conversion going on, for example if  plug: is being used on  
> Alsa? I'm a little concerned that some people might be recording with  
> worse quality than they think and would like to be able to give some  
> warning at least.

The sources/sink are always run in the "native" format of the
underlying device (unless the native format is very exotic or the
underlying API is too limited to allow us query the native
format). If you connect a stream to a device that doesn't match in
channel map, sample rate, sample format of course
conversion/resampling needs to take place. You can query the
sample_spec/channel_map of the device and compare it with your
stream's and then you know whether conversion takes place or not.


Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

More information about the pulseaudio-discuss mailing list