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
impl CodecStringOptions
Sourcepub fn video() -> Self
pub fn video() -> Self
Options for video: only name and fmtp; no numeric qualifiers.
Matches FreeSWITCH’s video path in add_audio_codec.
Sourcepub fn with_ptime(self, emit: bool) -> Self
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.
Sourcepub fn with_bitrate(self, emit: bool) -> Self
pub fn with_bitrate(self, emit: bool) -> Self
Emit or suppress the bitrate qualifier (@<n>b).
Sourcepub fn with_channels(self, emit: bool) -> Self
pub fn with_channels(self, emit: bool) -> Self
Emit or suppress the channel count qualifier (@<n>c).
Sourcepub fn emits_rate(&self) -> bool
pub fn emits_rate(&self) -> bool
Whether rate will be emitted.
Sourcepub fn emits_ptime(&self) -> bool
pub fn emits_ptime(&self) -> bool
Whether ptime will be emitted.
Sourcepub fn emits_bitrate(&self) -> bool
pub fn emits_bitrate(&self) -> bool
Whether bitrate will be emitted.
Sourcepub fn emits_channels(&self) -> bool
pub fn emits_channels(&self) -> bool
Whether channels will be emitted.
Sourcepub fn emits_fmtp(&self) -> bool
pub fn emits_fmtp(&self) -> bool
Whether fmtp will be emitted.
Sourcepub fn sdp_codec_to_entry(
&self,
codec: &SdpCodec,
) -> Result<CodecStringEntry, CodecStringError>
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
impl Clone for CodecStringOptions
Source§fn clone(&self) -> CodecStringOptions
fn clone(&self) -> CodecStringOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodecStringOptions
impl Debug for CodecStringOptions
Source§impl Default for CodecStringOptions
impl Default for CodecStringOptions
impl Eq for CodecStringOptions
Source§impl PartialEq for CodecStringOptions
impl PartialEq for CodecStringOptions
impl StructuralPartialEq for CodecStringOptions
Auto Trait Implementations§
impl Freeze for CodecStringOptions
impl RefUnwindSafe for CodecStringOptions
impl Send for CodecStringOptions
impl Sync for CodecStringOptions
impl Unpin for CodecStringOptions
impl UnsafeUnpin for CodecStringOptions
impl UnwindSafe for CodecStringOptions
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.