Skip to main content

ConnectionStats

Struct ConnectionStats 

Source
pub struct ConnectionStats {
    pub connections: u32,
    pub video_frames_received: u64,
    pub audio_frames_received: u64,
    pub metadata_frames_received: u64,
    pub video_frames_dropped: u64,
    pub audio_frames_dropped: u64,
    pub metadata_frames_dropped: u64,
    pub video_frames_queued: u32,
    pub audio_frames_queued: u32,
    pub metadata_frames_queued: u32,
}
Expand description

Connection and performance statistics for a receiver.

Provides detailed metrics about receiver health including connection count, frame counts, and drop rates. Useful for monitoring and diagnostics.

Fields§

§connections: u32

Number of active connections to this receiver

§video_frames_received: u64

Total number of video frames received

§audio_frames_received: u64

Total number of audio frames received

§metadata_frames_received: u64

Total number of metadata frames received

§video_frames_dropped: u64

Number of video frames dropped due to buffer overflow or processing delays

§audio_frames_dropped: u64

Number of audio frames dropped

§metadata_frames_dropped: u64

Number of metadata frames dropped

§video_frames_queued: u32

Number of video frames currently queued for processing

§audio_frames_queued: u32

Number of audio frames currently queued

§metadata_frames_queued: u32

Number of metadata frames currently queued

Implementations§

Source§

impl ConnectionStats

Source

pub fn video_drop_percentage(&self) -> f64

Calculate video frame drop percentage.

Returns the percentage of video frames that were dropped out of the total received + dropped. Returns 0.0 if no frames have been received.

§Examples
let stats = ConnectionStats {
    connections: 1,
    video_frames_received: 900,
    video_frames_dropped: 100,
    audio_frames_received: 0,
    audio_frames_dropped: 0,
    metadata_frames_received: 0,
    metadata_frames_dropped: 0,
    video_frames_queued: 5,
    audio_frames_queued: 0,
    metadata_frames_queued: 0,
};
assert_eq!(stats.video_drop_percentage(), 10.0);
Source

pub fn audio_drop_percentage(&self) -> f64

Calculate audio frame drop percentage.

Returns the percentage of audio frames that were dropped out of the total received + dropped. Returns 0.0 if no frames have been received.

Source

pub fn metadata_drop_percentage(&self) -> f64

Calculate metadata frame drop percentage.

Returns the percentage of metadata frames that were dropped out of the total received + dropped. Returns 0.0 if no frames have been received.

Source

pub fn is_connected(&self) -> bool

Check if the receiver is currently connected.

Returns true if there is at least one active connection.

Trait Implementations§

Source§

impl Clone for ConnectionStats

Source§

fn clone(&self) -> ConnectionStats

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 ConnectionStats

Source§

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

Formats the value using the given formatter. Read more

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.