Skip to main content

StreamTx

Struct StreamTx 

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

Outgoing encoded stream.

A stream is a primary SSRC + optional RTX SSRC.

This is RTP level API. For frame level API see Rtc::writer.

Implementations§

Source§

impl StreamTx

Source

pub fn ssrc(&self) -> Ssrc

The (primary) SSRC of this encoded stream.

Source

pub fn rtx(&self) -> Option<Ssrc>

The resend (RTX) SSRC of this encoded stream.

Source

pub fn mid(&self) -> Mid

Mid for this stream.

In SDP this corresponds to m-line and “Media”.

Source

pub fn rid(&self) -> Option<Rid>

Rid for this stream.

This is used to separate streams with the same Mid when using simulcast.

Source

pub fn queue_info(&self) -> Option<&dyn StreamTxQueueInfo>

Information sampled during the latest pacer update for this stream’s send queue.

This is None until the pacer has observed the stream for the first time. Calling this method does not refresh the information; use StreamTxQueueInfo::created_at() to determine whether a new sample is available.

Source

pub fn set_rtx_cache( &mut self, max_packets: usize, max_age: Duration, rtx_ratio_cap: Option<f32>, )

Configure the RTX (resend) cache.

This determines how old incoming NACKs we can reply to.

rtx_ratio_cap determines when to clear queued resends because of too many resends, i.e. if tx_sum / (rtx_sum + tx_sum) > rtx_ratio_cap. None disables this functionality so all queued resends will be sent.

The default is 2000 packets over 3 seconds and RTX cache drop ratio of 0.15.

Source

pub fn set_nack_policy(&mut self, policy: Option<NackPolicy>)

Configure per-packet limits on answering incoming NACKs.

Without a policy (the default) every NACK for a packet still in the RTX cache queues an RTX resend, so a receiver repeating a NACK gets the packet again each time, and the queue of resends is only bounded by the rtx_ratio_cap (see StreamTx::set_rtx_cache). Resends without RTX (in-band on the main SSRC) are bounded by NackPolicy::default even without a policy.

With a policy, a NACKed packet is resent at most NackPolicy::max_resends times, and not again within min(min_interval, rtt_factor × RTT) of its last resend (or of its first send, with NackPolicy::hold_after_send). At most NackPolicy::max_queued_resends resends wait in the queue; the rest are dropped and counted in MediaEgressStats::resends_dropped. The policy applies to RTX and in-band resends alike.

Source

pub fn set_unpaced(&mut self, unpaced: bool)

Set whether this stream is unpaced or not.

This is only relevant when BWE (Bandwidth Estimation) is enabled. By default, audio is unpaced thus not held to a steady send rate by the Pacer.

This overrides the default behavior.

Source

pub fn write_rtp(&mut self, rtp: RtpWrite)

Write RTP packet to a send stream.

The write command carries the RTP payload and optional RTP metadata.

Trait Implementations§

Source§

impl Debug for StreamTx

Source§

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

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CryptoSafe for T
where T: Send + Sync + Debug,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more