pub struct ClientMetrics {
pub average_processing_time_ms: f64,
pub frames_acknowledged: u32,
pub last_ack_time: Option<Instant>,
pub estimated_bandwidth_kbps: Option<f64>,
pub connection_rtt_ms: Option<u64>,
}Expand description
Client performance metrics for adaptive streaming
Fields§
§average_processing_time_ms: f64Exponential moving average of client frame-processing time, in milliseconds.
frames_acknowledged: u32Number of frames the client has acknowledged.
last_ack_time: Option<Instant>Instant of the most recent acknowledgement, if any.
estimated_bandwidth_kbps: Option<f64>Estimated downlink bandwidth, in kilobits per second, if measured.
connection_rtt_ms: Option<u64>Round-trip time of the WebSocket connection, in milliseconds, if measured.
Implementations§
Source§impl ClientMetrics
impl ClientMetrics
Sourcepub fn update_processing_time(&mut self, processing_time_ms: u64)
pub fn update_processing_time(&mut self, processing_time_ms: u64)
Fold a new processing-time observation into the moving average.
Sourcepub fn is_client_slow(&self) -> bool
pub fn is_client_slow(&self) -> bool
Returns true when average client processing time exceeds the slow-client threshold.
Sourcepub fn recommended_frame_delay(&self) -> Duration
pub fn recommended_frame_delay(&self) -> Duration
Recommended delay between frames given the current processing-time average.
Clamped to MAX_ADAPTIVE_FRAME_DELAY: average_processing_time_ms is derived
from client-supplied processing_time_ms in Self::update_processing_time,
which is unvalidated wire input (see handle_frame_ack). Without a ceiling, a
single malicious FrameAck could drive the tokio::time::sleep in
AdaptiveStreamController::stream_frames to an arbitrarily long duration and
stall that session’s stream.
Trait Implementations§
Source§impl Debug for ClientMetrics
impl Debug for ClientMetrics
Source§impl Default for ClientMetrics
impl Default for ClientMetrics
Source§fn default() -> ClientMetrics
fn default() -> ClientMetrics
Auto Trait Implementations§
impl Freeze for ClientMetrics
impl RefUnwindSafe for ClientMetrics
impl Send for ClientMetrics
impl Sync for ClientMetrics
impl Unpin for ClientMetrics
impl UnsafeUnpin for ClientMetrics
impl UnwindSafe for ClientMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more