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: StringThe LiveKit track identifier (TR_…); the value is unchanged from the former track_sid field.
kind: TrackKindAudio or video.
direction: StreamDirectionSent (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.