[vbox-dev] PulseAudio support rewrite [Patch]

Arthur Taylor art at ified.ca
Tue Jan 5 23:48:14 PST 2010


> Yeah, it is probably no problem if the client is newer than the server
> but it is a problem that we are loading libpulse.so.0 dynamically which
> means that the client library could be older than the headers which were
> used to compile the VBox code. In that case, pa_stream_connect_playback() /
> pa_stream_connect_record() would return with an error if an unknown flag
> is specified. But this isn't a big problem for us as we compile against
> the correct libraries / headers on the corresponding Linux distributions.

That should probably barf on other issues. I've had libpulse fail
mainloop related assertions before the context is connected from old
client libraries.

> I have to load that flag out here as I'm on Debian/Lenny. Another problem
> I saw is that the playback sound is quite choppy because tlength is set to
> a short value (a tenth of the buffer size). If I increase tlength to a half
> of the buffer size, the sound is ok. The old code even used 66% of the
> buffer size. Is there any reason to use such a small value (a tenth of the
> buffer size) for tlength?

Actually just thinking about that now, perhaps another behavior should
be used. For playback, setting maxlength doesn't make sense really.
This virtualbox situation is simulating a hardware buffer rather than
usual playback, and the hardware buffer has a fake length. Setting the
pulse maxlength does nothing really. If data is written past the
current pulse read position + maxlength you get an overflow error, not
a wraparound or a shifting. Timing of the stream is based upon the
tlength, not maxlength. pa_stream_writable_size returns tlength - fill
level or 0 if more than tlength bytes are in the buffer. A better
behaviour would probably be to set maxlength to -1 as recommended and
then set tlength to be a sane value like 50ms where the vbox-side
buffer would be 300ms-ish by default. Thoughts?

For record streams setting maxlength makes sense as you don't want to
hear audio from 20s ago by mistake, although the patch corks the
record stream so that shouldn't be a problem either.

If you've made some changes, could you send them back so we can work
on the same revisions.

- Art

Arthur Taylor
art at ified.ca
theycallhimart at gmail.com

More information about the vbox-dev mailing list