Skip to main content

CodecStringOptions

Struct CodecStringOptions 

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

Controls which qualifiers appear in a CodecStringEntry built from an SdpCodec.

Audio defaults emit rate, ptime, bitrate, and channels but not fmtp (see docs/codec-string-format.md — audio fmtp in the codec string does not reach a generated offer unless the leg has a bridged partner). Video entries emit only name and fmtp, no numeric qualifiers.

This deliberately deviates from FreeSWITCH’s own add_audio_codec, which emits @<n>c only when channels > 1 and never emits @<n>b and @<n>c together — the two share one format buffer, so one overwrites the other (switch_core_media.c:13530-13536, see docs/codec-string-format.md). Audio defaults here emit @1c on every mono codec and can emit both qualifiers at once. This is behaviourally neutral for matching and dedup — an absent channel count normalizes to 1 either way — but it is not a byte-for-byte port of upstream’s emission quirk.

Implementations§

Source§

impl CodecStringOptions

Source

pub fn audio() -> Self

Default options for audio: rate, ptime, bitrate, channels on; fmtp off.

Source

pub fn video() -> Self

Options for video: only name and fmtp; no numeric qualifiers.

Matches FreeSWITCH’s video path in add_audio_codec.

Source

pub fn with_rate(self, emit: bool) -> Self

Emit or suppress the rate qualifier (@<n>h).

Source

pub fn with_ptime(self, emit: bool) -> Self

Emit or suppress the ptime qualifier (@<n>i).

§Warning

For G.722, suppressing ptime while keeping rate causes FreeSWITCH to select whichever implementation is first in its list rather than the 20 ms default, potentially producing non-standard packetization. Leave this on.

Source

pub fn with_bitrate(self, emit: bool) -> Self

Emit or suppress the bitrate qualifier (@<n>b).

Source

pub fn with_channels(self, emit: bool) -> Self

Emit or suppress the channel count qualifier (@<n>c).

Source

pub fn with_fmtp(self, emit: bool) -> Self

Emit or suppress the fmtp (~fmtp segment).

Source

pub fn emits_rate(&self) -> bool

Whether rate will be emitted.

Source

pub fn emits_ptime(&self) -> bool

Whether ptime will be emitted.

Source

pub fn emits_bitrate(&self) -> bool

Whether bitrate will be emitted.

Source

pub fn emits_channels(&self) -> bool

Whether channels will be emitted.

Source

pub fn emits_fmtp(&self) -> bool

Whether fmtp will be emitted.

Source

pub fn sdp_codec_to_entry( &self, codec: &SdpCodec, ) -> Result<CodecStringEntry, CodecStringError>

Convert an SdpCodec into a CodecStringEntry honouring these options.

Returns Err if the codec name or fmtp value would produce an invalid entry (wire-injection, @ in fmtp, dotted fmtp without a module prefix).

Trait Implementations§

Source§

impl Clone for CodecStringOptions

Source§

fn clone(&self) -> CodecStringOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CodecStringOptions

Source§

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

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

impl Default for CodecStringOptions

Source§

fn default() -> Self

Audio-mode defaults: rate, ptime, bitrate, channels on; fmtp off.

Source§

impl Eq for CodecStringOptions

Source§

impl PartialEq for CodecStringOptions

Source§

fn eq(&self, other: &CodecStringOptions) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CodecStringOptions

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.