Struct TimingInfo

Source
#[repr(C)]
pub struct TimingInfo {
Show 13 fields pub timestamp: UnixTs, pub synchronized_clocks: i32, pub sink_usec: MicroSeconds, pub source_usec: MicroSeconds, pub transport_usec: MicroSeconds, pub playing: i32, pub write_index_corrupt: i32, pub write_index: i64, pub read_index_corrupt: i32, pub read_index: i64, pub configured_sink_usec: MicroSeconds, pub configured_source_usec: MicroSeconds, pub since_underrun: i64,
}
Expand description

A structure for all kinds of timing information of a stream.

See Stream::update_timing_info() and Stream::get_timing_info().

The total output latency a sample that is written with Stream::write() takes to be played may be estimated by:

sink_usec + buffer_usec + transport_usec

(Where buffer_usec is defined as the result of passing write_index - read_index to Spec::bytes_to_usec()). The output buffer which buffer_usec relates to may be manipulated freely (with Stream::write()’s seek argument, Stream::flush() and friends), the buffers sink_usec and source_usec relate to are first-in first-out (FIFO) buffers which cannot be flushed or manipulated in any way. The total input latency a sample that is recorded takes to be delivered to the application is:

source_usec + buffer_usec + transport_usec - sink_usec

(Take care of sign issues!). When connected to a monitor source sink_usec contains the latency of the owning sink. The two latency estimations described here are implemented in Stream::get_latency().

All time values are in the sound card clock domain, unless noted otherwise. The sound card clock usually runs at a slightly different rate than the system clock.

Please note that this structure can be extended as part of evolutionary API updates at any time in any new release.

Fields§

§timestamp: UnixTs

The system clock time when this timing info structure was current.

§synchronized_clocks: i32

Non-zero if the local and the remote machine have synchronized clocks. If synchronized clocks are detected transport_usec becomes much more reliable. However, the code that detects synchronized clocks is very limited and unreliable itself.

§sink_usec: MicroSeconds

Time in usecs a sample takes to be played on the sink. For playback streams and record streams connected to a monitor source.

§source_usec: MicroSeconds

Time in usecs a sample takes from being recorded to being delivered to the application. Only for record streams.

§transport_usec: MicroSeconds

Estimated time in usecs a sample takes to be transferred to/from the daemon. For both playback and record streams.

§playing: i32

Non-zero when the stream is currently not underrun and data is being passed on to the device. Only for playback streams. This field does not say whether the data is actually already being played. To determine this check whether since_underrun (converted to usec) is larger than sink_usec.

§write_index_corrupt: i32

Non-zero if write_index is not up-to-date because a local write command that corrupted it has been issued in the time since this latency info was current. Only write commands with SeekMode::RelativeOnRead and SeekMode::RelativeEnd can corrupt write_index.

§write_index: i64

Current write index into the playback buffer in bytes.

Think twice before using this for seeking purposes: it might be out of date at the time you want to use it. Consider using SeekMode::Relative instead.

§read_index_corrupt: i32

Non-zero if read_index is not up-to-date because a local pause or flush request that corrupted it has been issued in the time since this latency info was current.

§read_index: i64

Current read index into the playback buffer in bytes.

Think twice before using this for seeking purposes: it might be out of date at the time you want to use it. Consider using SeekMode::RelativeOnRead instead.

§configured_sink_usec: MicroSeconds

The configured latency for the sink.

§configured_source_usec: MicroSeconds

The configured latency for the source.

§since_underrun: i64

Bytes that were handed to the sink since the last underrun happened, or since playback started again after the last underrun. playing will tell you which case it is.

Trait Implementations§

Source§

impl AsRef<TimingInfo> for pa_timing_info

Source§

fn as_ref(&self) -> &TimingInfo

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

impl Clone for TimingInfo

Source§

fn clone(&self) -> TimingInfo

Returns a duplicate 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 TimingInfo

Source§

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

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

impl PartialEq for TimingInfo

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for TimingInfo

Source§

impl Eq for TimingInfo

Source§

impl StructuralPartialEq for TimingInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.