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
impl StreamTx
Sourcepub fn rid(&self) -> Option<Rid>
pub fn rid(&self) -> Option<Rid>
Rid for this stream.
This is used to separate streams with the same Mid when using simulcast.
Sourcepub fn queue_info(&self) -> Option<&dyn StreamTxQueueInfo>
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.
Sourcepub fn set_rtx_cache(
&mut self,
max_packets: usize,
max_age: Duration,
rtx_ratio_cap: Option<f32>,
)
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.
Sourcepub fn set_nack_policy(&mut self, policy: Option<NackPolicy>)
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.
Sourcepub fn set_unpaced(&mut self, unpaced: bool)
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.