Skip to main content

CbrController

Struct CbrController 

Source
pub struct CbrController { /* private fields */ }
Expand description

Constant Bitrate rate controller.

Uses a leaky bucket model to maintain constant bitrate output.

Implementations§

Source§

impl CbrController

Source

pub fn new(config: &RcConfig) -> Self

Create a new CBR controller from configuration.

Source

pub fn set_qp_gain(&mut self, gain: f32)

Set the QP adjustment gain factor.

Source

pub fn set_allow_frame_drop(&mut self, allow: bool)

Enable or disable frame dropping.

Source

pub fn get_rc(&mut self, frame_type: FrameType) -> RcOutput

Get rate control output for a frame.

Source

pub fn update(&mut self, stats: &FrameStats)

Update controller with frame statistics.

Source

pub fn buffer_fullness(&self) -> f32

Get current buffer fullness (0.0 - 1.0).

Source

pub fn buffer_level(&self) -> u64

Get current buffer level in bits.

Source

pub fn average_bitrate(&self, elapsed_seconds: f64) -> f64

Get average bitrate achieved.

Source

pub fn short_term_bitrate(&self, fps: f64) -> f64

Get short-term bitrate (over recent frames).

Source

pub fn target_bitrate(&self) -> u64

Get target bitrate.

Source

pub fn frame_count(&self) -> u64

Get frame count.

Source

pub fn frames_dropped(&self) -> u64

Get frames dropped.

Source

pub fn current_qp(&self) -> f32

Get current QP.

Source

pub fn reset(&mut self)

Reset the controller state.

Source

pub fn is_overflow_risk(&self) -> bool

Check if buffer is in overflow danger zone.

Source

pub fn is_underflow_risk(&self) -> bool

Check if buffer is in underflow danger zone.

Trait Implementations§

Source§

impl Clone for CbrController

Source§

fn clone(&self) -> CbrController

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 CbrController

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for CbrController

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl RateController for CbrController

Source§

fn get_output(&mut self, frame_type: FrameType, _complexity: f32) -> RcOutput

Get rate control output for a frame.
Source§

fn update_stats(&mut self, stats: &FrameStats)

Update controller with frame encoding results.
Source§

fn reset(&mut self)

Reset the controller state.
Source§

fn current_qp(&self) -> f32

Get the current QP value.
Source§

fn frame_count(&self) -> u64

Get total frames processed.
Source§

fn total_bits(&self) -> u64

Get total bits produced.

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.