pub enum Codec {
Pcmu,
Pcma,
L16,
Opus,
}Expand description
Which G.711 flavour a session carries.
Variants§
Pcmu
µ-law, payload type 0.
Pcma
A-law, payload type 8.
L16
Signed 16-bit network-order linear PCM (RFC 3551 §4.5.11).
Static payload type 11 is mono at 44.1 kHz. Other negotiated rates use a dynamic payload
assignment and override Config::clock_rate.
Opus
Opus (RFC 6716), on whatever dynamic payload type was negotiated.
Unlike the G.711 pair this carries state: an Opus encoder and decoder each hold a model of the signal they have seen, which is how the codec achieves what it does and why it cannot be a pure function of one frame. The state lives in the send and receive loops, one each, so nothing is shared and nothing is locked.
Implementations§
Source§impl Codec
impl Codec
Sourcepub fn payload_type(self) -> u8
pub fn payload_type(self) -> u8
The static payload type.
Sourcepub fn clock_rate(self) -> u32
pub fn clock_rate(self) -> u32
The RTP clock rate, which is not always the sample rate.
RFC 7587 §7 fixes Opus’s RTP clock at 48000 whatever the audio is sampled at. A stack that used the sample rate instead produces timestamps the far end reads at the wrong speed.
Sourcepub fn from_payload_type(payload_type: u8) -> Option<Self>
pub fn from_payload_type(payload_type: u8) -> Option<Self>
The codec for a payload type, if it is one we carry.
Trait Implementations§
impl Copy for Codec
impl Eq for Codec
impl StructuralPartialEq for Codec
Auto Trait Implementations§
impl Freeze for Codec
impl RefUnwindSafe for Codec
impl Send for Codec
impl Sync for Codec
impl Unpin for Codec
impl UnsafeUnpin for Codec
impl UnwindSafe for Codec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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>
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