[pulseaudio-discuss] Buffering attributes with variable format
arun.raghavan at collabora.co.uk
Mon Oct 10 09:57:03 PDT 2011
On Mon, 2011-10-10 at 19:24 +0300, Rémi Denis-Courmont wrote:
> Le lundi 10 octobre 2011 18:35:02 Pierre-Louis Bossart, vous avez écrit :
> > > Whether passing multiple format infos to negotiate digital passthrough,
> > > or
> > > setting one of the PA_STREAM_FIX_* flags on a record stream, I'm a bit
> > > puzzled
> > > how the buffering attributes are supposed to work.
> > >
> > > Most of the values are expressed in bytes. How should the application
> > > negotiate certain timings then? The mapping of bytes to microseconds
> > > depends
> > > on the bitrate, which is not known to the application until after
> > > PulseAudio
> > > chooses the exact stream format and returns it.
> > Actually there's no variable format.
> Yeah? I never said there were formats with variable bit rate. I said I don't
> know the format, hence the bit rate, until after the buffer attributes have
> already been transmitted.
> > With the IEC61937 format, the
> > compressed frames are padded with zeroes to reach the same bitrate as 2ch,
> > 16-bit PCM. In short if you have AC3 at 48kHz, PulseAudio will handle
> > 1,536 Mbits/s. You can set the buffering as if it was a PCM stream. I
> > would recommend you set -1 to all the fields and let PulseAudio select the
> > best buffering for low-power.
> This is only an option if there are no latency constraints.
You could pick the most conservative of your formats and then adjust
after connecting using pa_stream_set_buffer_attr().
To do this the "right way", we'd need to change how stream setup is done
to have an intermediate stage and it's quite a large change for benefits
that don't seem to be worth the cost.
More information about the pulseaudio-discuss