[vbox-dev] PulseAudio support rewrite [Patch]

Frank Mehnert Frank.Mehnert at Sun.COM
Thu Jan 7 00:31:48 PST 2010


On Wednesday 06 January 2010, Arthur Taylor wrote:
> > 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?

Yes, when setting maxlength and tlength to -1, PulseAudio 0.9.21
will select some sane default values, 4MB for maxlength and 250ms
for tlength. But these default settings are not implemented for
older releases, in particular not for version 0.9.10 I'm using here.
Setting maxlength to -1 is not allowed if buffer_attr != NULL. Therefore
I've changed the values for tlength to 100ms and maxlength to 3/2 of
tlength as it was before. I've not changed your default values for
audio input as I did not test audio input yet.

> 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.

Sure, I've just committed the current state of affairs, see


Thanks + Kind regards,

Dr.-Ing. Frank Mehnert

Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Thomas Schröder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.virtualbox.org/pipermail/vbox-dev/attachments/20100107/48bd6c54/attachment-0001.bin 

More information about the vbox-dev mailing list