pub(super) struct MediaBitrateCounter {
origin: Instant,
window_start_nanos: AtomicU64,
last_observed_nanos: AtomicU64,
bytes_in_window: AtomicU64,
completed_bps: AtomicU64,
observed: AtomicBool,
}Fields§
§origin: Instant§window_start_nanos: AtomicU64§last_observed_nanos: AtomicU64§bytes_in_window: AtomicU64§completed_bps: AtomicU64§observed: AtomicBoolImplementations§
Source§impl MediaBitrateCounter
impl MediaBitrateCounter
pub(super) fn new(now: Instant) -> Self
Sourcepub(super) fn record(
&self,
now: Instant,
payload_bytes: usize,
) -> IncomingBitrateObservation
pub(super) fn record( &self, now: Instant, payload_bytes: usize, ) -> IncomingBitrateObservation
The packet loop is the only writer. Cross-thread readers consume the completed sample and freshness atomics, never the in-progress byte bucket.
Exact saturating addition is not part of the observable contract because
one RTP bitrate window cannot approach u64::MAX.
pub(super) fn last_observed_age(&self, now: Instant) -> Option<Duration>
fn snapshot(&self, now: Instant) -> Bitrate
fn nanos_since_origin(&self, now: Instant) -> u64
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MediaBitrateCounter
impl RefUnwindSafe for MediaBitrateCounter
impl Send for MediaBitrateCounter
impl Sync for MediaBitrateCounter
impl Unpin for MediaBitrateCounter
impl UnsafeUnpin for MediaBitrateCounter
impl UnwindSafe for MediaBitrateCounter
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
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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