pub struct TrackCodec {
pub payload_type_map: Arc<RwLock<HashMap<u8, CodecType>>>,
/* private fields */
}Fields§
§payload_type_map: Arc<RwLock<HashMap<u8, CodecType>>>Implementations§
Source§impl TrackCodec
impl TrackCodec
pub fn new() -> Self
Sourcepub fn enable_concealment(&mut self)
pub fn enable_concealment(&mut self)
Have the decoders conceal lost packets, for Self::conceal.
Sourcepub fn conceal(
&mut self,
ptime: Duration,
next: Option<(u8, &[u8])>,
) -> Option<(u32, u16, PcmBuf, bool)>
pub fn conceal( &mut self, ptime: Duration, next: Option<(u8, &[u8])>, ) -> Option<(u32, u16, PcmBuf, bool)>
Audio for one lost packet of ptime, from the decoder of the last
packet decoded, as (native_sample_rate, channels, samples) like
Self::decode, and whether next was used. With next, the
payload type and payload of the packet right after the loss, Opus
rebuilds the lost one from its in-band FEC (where the sender coded
any, else it conceals); other codecs conceal. None when concealment
is off, nothing was decoded yet, or the codec has no concealment.
Sourcepub fn set_opus_params(&mut self, params: OpusParams)
pub fn set_opus_params(&mut self, params: OpusParams)
Encode Opus as the receiver’s a=fmtp asks (see OpusParams).
Sourcepub fn set_opus_packet_loss(&mut self, percent: i32)
pub fn set_opus_packet_loss(&mut self, percent: i32)
Have Opus expect this packet loss, in percent (see
OpusLossEstimate).
pub fn opus_params(&self) -> OpusParams
pub fn set_payload_type(&mut self, pt: u8, codec: CodecType)
Sourcepub fn get_codec_for_pt(&self, pt: u8) -> Option<CodecType>
pub fn get_codec_for_pt(&self, pt: u8) -> Option<CodecType>
Look up the codec for a given RTP payload type, consulting the negotiated map first and falling back to the static payload type registry.
Sourcepub fn decode(&mut self, payload_type: u8, payload: &[u8]) -> (u32, u16, PcmBuf)
pub fn decode(&mut self, payload_type: u8, payload: &[u8]) -> (u32, u16, PcmBuf)
Decode an RTP payload into PCM at the codec’s native sample rate.
Returns (native_sample_rate, channels, samples); resampling to the
pipeline rate is the caller’s responsibility (see ProcessorChain).
pub fn resample(&mut self, pcm: PcmBuf, in_rate: u32, out_rate: u32) -> PcmBuf
pub fn encode(&mut self, payload_type: u8, frame: AudioFrame) -> (u8, Vec<u8>)
Trait Implementations§
Auto Trait Implementations§
impl !UnwindSafe for TrackCodec
impl Forget for TrackCodec
impl Freeze for TrackCodec
impl Move for TrackCodec
impl RefUnwindSafe for TrackCodec
impl Send for TrackCodec
impl Sync for TrackCodec
impl Unpin for TrackCodec
impl UnsafeUnpin for TrackCodec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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> ⓘ
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