pub struct BitrateRunningAnalyzer { /* private fields */ }Expand description
A composite analyzer that tracks per-frame bitrate statistics across a single encode pass using all available online estimators.
This is the primary integration point between running_stats and the
bitrate_estimator module. Feed it the bit count for each encoded frame;
query aggregate statistics at any time without buffering frame data.
§Example
use oximedia_transcode::running_stats::BitrateRunningAnalyzer;
let mut analyzer = BitrateRunningAnalyzer::new(30.0, 60);
for bits in [40_000u64, 50_000, 60_000, 45_000, 55_000] {
analyzer.push_frame(bits);
}
let summary = analyzer.summary();
assert!(summary.mean_bps > 0.0);
assert!(summary.peak_bps >= summary.mean_bps);Implementations§
Source§impl BitrateRunningAnalyzer
impl BitrateRunningAnalyzer
Sourcepub fn new(fps: f64, window_frames: usize) -> Self
pub fn new(fps: f64, window_frames: usize) -> Self
Creates a new analyzer.
fps– The frame rate of the encoded stream.window_frames– Size of the rolling window for recent-peak analysis.
Sourcepub fn push_frame(&mut self, bits_per_frame: u64)
pub fn push_frame(&mut self, bits_per_frame: u64)
Feeds the bit count for one encoded frame into all estimators.
Sourcepub fn summary(&self) -> BitrateSummary
pub fn summary(&self) -> BitrateSummary
Returns a point-in-time BitrateSummary from all running estimators.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BitrateRunningAnalyzer
impl RefUnwindSafe for BitrateRunningAnalyzer
impl Send for BitrateRunningAnalyzer
impl Sync for BitrateRunningAnalyzer
impl Unpin for BitrateRunningAnalyzer
impl UnsafeUnpin for BitrateRunningAnalyzer
impl UnwindSafe for BitrateRunningAnalyzer
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
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>
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