pub struct TrackLocalStaticRTP { /* private fields */ }
Expand description
TrackLocalStaticRTP is a TrackLocal that has a pre-set codec and accepts RTP Packets. If you wish to send a media.Sample use TrackLocalStaticSample
Implementations§
source§impl TrackLocalStaticRTP
impl TrackLocalStaticRTP
sourcepub fn new(codec: RTCRtpCodecCapability, id: String, stream_id: String) -> Self
pub fn new(codec: RTCRtpCodecCapability, id: String, stream_id: String) -> Self
returns a TrackLocalStaticRTP.
sourcepub fn codec(&self) -> RTCRtpCodecCapability
pub fn codec(&self) -> RTCRtpCodecCapability
codec gets the Codec of the track
pub async fn any_binding_paused(&self) -> bool
pub async fn all_binding_paused(&self) -> bool
sourcepub async fn write_rtp_with_extensions(
&self,
p: &Packet,
extensions: &[HeaderExtension]
) -> Result<usize>
pub async fn write_rtp_with_extensions( &self, p: &Packet, extensions: &[HeaderExtension] ) -> Result<usize>
write_rtp_with_extensions writes a RTP Packet to the TrackLocalStaticRTP If one PeerConnection fails the packets will still be sent to all PeerConnections. The error message will contain the ID of the failed PeerConnections so you can remove them
If the RTCRtpSender direction is such that no packets should be sent, any call to this function are blocked internally. Care must be taken to not increase the sequence number while the sender is paused. While the actual sending is blocked, the receiver will miss out when the sequence number “rolls over”, which in turn will break SRTP.
Extensions that are already configured on the packet are overwritten by extensions in
extensions
.
Trait Implementations§
source§impl Debug for TrackLocalStaticRTP
impl Debug for TrackLocalStaticRTP
source§impl TrackLocal for TrackLocalStaticRTP
impl TrackLocal for TrackLocalStaticRTP
source§fn bind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<RTCRtpCodecParameters>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn bind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<RTCRtpCodecParameters>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
bind is called by the PeerConnection after negotiation is complete This asserts that the code requested is supported by the remote peer. If so it setups all the state (SSRC and PayloadType) to have a call
source§fn unbind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unbind<'life0, 'life1, 'async_trait>(
&'life0 self,
t: &'life1 TrackLocalContext
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
unbind implements the teardown logic when the track is no longer needed. This happens because a track has been stopped.
source§fn id(&self) -> &str
fn id(&self) -> &str
id is the unique identifier for this Track. This should be unique for the stream, but doesn’t have to globally unique. A common example would be ‘audio’ or ‘video’ and StreamID would be ‘desktop’ or ‘webcam’
source§fn stream_id(&self) -> &str
fn stream_id(&self) -> &str
stream_id is the group this track belongs too. This must be unique
source§fn kind(&self) -> RTPCodecType
fn kind(&self) -> RTPCodecType
kind controls if this TrackLocal is audio or video
fn as_any(&self) -> &dyn Any
source§impl TrackLocalWriter for TrackLocalStaticRTP
impl TrackLocalWriter for TrackLocalStaticRTP
source§fn write_rtp<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 Packet
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_rtp<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 Packet
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
write_rtp writes a RTP Packet to the TrackLocalStaticRTP If one PeerConnection fails the packets will still be sent to all PeerConnections. The error message will contain the ID of the failed PeerConnections so you can remove them
If the RTCRtpSender direction is such that no packets should be sent, any call to this function are blocked internally. Care must be taken to not increase the sequence number while the sender is paused. While the actual sending is blocked, the receiver will miss out when the sequence number “rolls over”, which in turn will break SRTP.
source§fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
b: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
b: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
write writes a RTP Packet as a buffer to the TrackLocalStaticRTP If one PeerConnection fails the packets will still be sent to all PeerConnections. The error message will contain the ID of the failed PeerConnections so you can remove them