#[repr(C)]
pub struct BufferAttr { pub maxlength: u32, pub tlength: u32, pub prebuf: u32, pub minreq: u32, pub fragsize: u32, }
Expand description

Playback and record buffer metrics.

Fields§

§maxlength: u32

Maximum length of the buffer in bytes.

Setting this to std::u32::MAX will initialize this to the maximum value supported by the server, which is recommended. In strict low-latency playback scenarios you might want to set this to a lower value, likely together with the stream::FlagSet::ADJUST_LATENCY flag. If you do so, you ensure that the latency doesn’t grow beyond what is acceptable for the use case, at the cost of getting more underruns if the latency is lower than what the server can reliably handle.

§tlength: u32

Target length of the buffer (playback only). The server tries to assure that at least tlength bytes are always available in the per-stream server-side playback buffer. The server will only send requests for more data as long as the buffer has less than this number of bytes of data.

It is recommended to set this to std::u32::MAX, which will initialize this to a value that is deemed sensible by the server. However, this value will default to something like 2s; for applications that have specific latency requirements this value should be set to the maximum latency that the application can deal with.

When stream::FlagSet::ADJUST_LATENCY is not set this value will influence only the per-stream playback buffer size. When stream::FlagSet::ADJUST_LATENCY is set, the overall latency of the sink plus the playback buffer size is configured to this value. Set stream::FlagSet::ADJUST_LATENCY if you are interested in adjusting the overall latency. Don’t set it if you are interested in configuring the server-side per-stream playback buffer size.

§prebuf: u32

Pre-buffering (playback only). The server does not start with playback before at least prebuf bytes are available in the buffer. It is recommended to set this to std::u32::MAX, which will initialize this to the same value as tlength, whatever that may be.

Initialize to 0 to enable manual start/stop control of the stream. This means that playback will not stop on underrun and playback will not start automatically, instead Stream::cork() needs to be called explicitly. If you set this value to 0 you should also set stream::FlagSet::START_CORKED. Should underrun occur, the read index of the output buffer overtakes the write index, and hence the fill level of the buffer is negative.

Start of playback can be forced using Stream::trigger() even though the prebuffer size hasn’t been reached. If a buffer underrun occurs, this prebuffering will be again enabled.

§minreq: u32

Minimum request (playback only). The server does not request less than minreq bytes from the client, instead it waits until the buffer is free enough to request more bytes at once.

It is recommended to set this to std::u32::MAX, which will initialize this to a value that is deemed sensible by the server. This should be set to a value that gives PulseAudio enough time to move the data from the per-stream playback buffer into the hardware playback buffer.

§fragsize: u32

Fragment size (recording only). The server sends data in blocks of fragsize bytes size.

Large values diminish interactivity with other operations on the connection context but decrease control overhead. It is recommended to set this to std::u32::MAX, which will initialize this to a value that is deemed sensible by the server. However, this value will default to something like 2s; For applications that have specific latency requirements this value should be set to the maximum latency that the application can deal with.

If stream::FlagSet::ADJUST_LATENCY is set the overall source latency will be adjusted according to this value. If it is not set the source latency is left unmodified.

Trait Implementations§

source§

impl AsRef<BufferAttr> for pa_buffer_attr

source§

fn as_ref(&self) -> &BufferAttr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<pa_buffer_attr> for BufferAttr

source§

fn as_ref(&self) -> &pa_buffer_attr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for BufferAttr

source§

fn clone(&self) -> BufferAttr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BufferAttr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for BufferAttr

source§

fn default() -> BufferAttr

Returns the “default value” for a type. Read more
source§

impl PartialEq<BufferAttr> for BufferAttr

source§

fn eq(&self, other: &BufferAttr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for BufferAttr

source§

impl Eq for BufferAttr

source§

impl StructuralEq for BufferAttr

source§

impl StructuralPartialEq for BufferAttr

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.