Skip to main content

RtcStatsSample

Struct RtcStatsSample 

Source
pub struct RtcStatsSample {
Show 27 fields pub track_id: String, pub kind: TrackKind, pub direction: StreamDirection, pub codec: Option<String>, pub bytes: Option<u64>, pub packets: Option<u64>, pub packets_lost: Option<u64>, pub freeze_count: Option<u64>, pub freezes_duration_ms: Option<u64>, pub concealed_samples: Option<u64>, pub concealment_events: Option<u64>, pub jitter_buffer_delay_ms: Option<u64>, pub jitter_buffer_emitted_count: Option<u64>, pub quality_limitation_bandwidth_ms: Option<u64>, pub quality_limitation_cpu_ms: Option<u64>, pub quality_limitation_other_ms: Option<u64>, pub pause_count: Option<u64>, pub pauses_duration_ms: Option<u64>, pub silent_concealed_samples: Option<u64>, pub interruption_count: Option<u64>, pub interruptions_duration_ms: Option<u64>, pub jitter_ms: Option<f64>, pub rtt_ms: Option<f64>, pub frames_per_second: Option<f64>, pub audio_level: Option<f64>, pub timestamp_ns: Option<u64>, pub layer: Option<String>,
}
Expand description

One reading of a track’s RTP statistics, as getStats() reports them.

Cumulative counters (bytes, packets, freeze_count, …) are passed through as reported — monotonic, paired with their denominators (the W3C webrtc-stats model) so any layer can recompute rates and a dropped window never corrupts the next. An outbound track whose readings name their RTP streams (layer) ships its bytes and packets as a running total of each stream’s growth instead, so a stream that comes and goes is never counted twice. Gauges (jitter_ms, rtt_ms, frames_per_second, audio_level) are summarised per window as min/max/avg. Fields a platform or direction does not have stay None and are omitted from the wire.

Fields§

§track_id: String

The LiveKit track identifier (TR_…); the value is unchanged from the former track_sid field.

§kind: TrackKind

Audio or video.

§direction: StreamDirection

Sent (outbound) or received (inbound).

§codec: Option<String>

The codec’s mimeType (video/VP8), resolved through the stream’s codecId.

§bytes: Option<u64>

bytesSent (outbound) or bytesReceived (inbound).

§packets: Option<u64>

packetsSent (outbound) or packetsReceived (inbound).

§packets_lost: Option<u64>

packetsLost, inbound.

§freeze_count: Option<u64>

freezeCount, inbound video: short stalls, a frame shown at least 3× the average frame time, and at least 150 ms more than it, after the one before. A longer gap is a pause instead.

§freezes_duration_ms: Option<u64>

totalFreezesDuration in milliseconds, inbound video.

§concealed_samples: Option<u64>

concealedSamples, inbound audio: samples the receiver made up for lost or late packets.

§concealment_events: Option<u64>

concealmentEvents, inbound audio: how many separate runs of concealment started (one loss burst is one event, however many samples it conceals).

§jitter_buffer_delay_ms: Option<u64>

jitterBufferDelay in milliseconds, inbound: the total time emitted samples or frames spent in the jitter buffer. Divide by jitter_buffer_emitted_count for the average.

§jitter_buffer_emitted_count: Option<u64>

jitterBufferEmittedCount, inbound: samples or frames that left the jitter buffer.

§quality_limitation_bandwidth_ms: Option<u64>

qualityLimitationDurations.bandwidth in milliseconds, outbound video.

§quality_limitation_cpu_ms: Option<u64>

qualityLimitationDurations.cpu in milliseconds, outbound video: time the encoder was limited by the CPU.

§quality_limitation_other_ms: Option<u64>

qualityLimitationDurations.other in milliseconds, outbound video.

§pause_count: Option<u64>

pauseCount, inbound video: gaps of more than 5 s without a frame (usually the sender paused). A shorter stall is a freeze instead.

§pauses_duration_ms: Option<u64>

totalPausesDuration in milliseconds, inbound video.

§silent_concealed_samples: Option<u64>

silentConcealedSamples, inbound audio: the concealed samples that were silence, which a listener cannot hear. Part of concealed_samples.

§interruption_count: Option<u64>

interruptionCount, inbound audio: concealment runs of 150 ms or more, long enough to hear.

§interruptions_duration_ms: Option<u64>

totalInterruptionDuration in milliseconds, inbound audio.

§jitter_ms: Option<f64>

jitter in milliseconds, inbound.

§rtt_ms: Option<f64>

Round-trip time in milliseconds: the remote-inbound-rtp roundTripTime (outbound), the selected candidate pair’s currentRoundTripTime (inbound).

§frames_per_second: Option<f64>

framesPerSecond, video.

§audio_level: Option<f64>

audioLevel, inbound audio: 0.0 to 1.0, linear (not dB).

§timestamp_ns: Option<u64>

When the reading was taken; None = now. All streams in one poll must share a timestamp.

§layer: Option<String>

The RTP stream this sample describes when a track has several (simulcast layers): any stable id (rid, ssrc, the stats id). The core folds layers into the track; a platform never sums them itself.

Implementations§

Source§

impl RtcStatsSample

Source

pub fn new( track_id: impl Into<String>, kind: TrackKind, direction: StreamDirection, ) -> Self

A sample with every optional field unset.

Trait Implementations§

Source§

impl Clone for RtcStatsSample

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RtcStatsSample

Source§

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

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

impl PartialEq for RtcStatsSample

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RtcStatsSample

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V