mediasoup::pipe_transport

Struct PipeTransport

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

A pipe transport represents a network path through which RTP, RTCP (optionally secured with SRTP) and SCTP (DataChannel) is transmitted. Pipe transports are intended to intercommunicate two Router instances collocated on the same host or on separate hosts.

§Notes on usage

When calling PipeTransport::consume, all RTP streams of the Producer are transmitted verbatim (in contrast to what happens in WebRtcTransport and PlainTransport in which a single and continuous RTP stream is sent to the consuming endpoint).

Implementations§

Source§

impl PipeTransport

Source

pub async fn connect( &self, remote_parameters: PipeTransportRemoteParameters, ) -> Result<(), RequestError>

Provide the PipeTransport with remote parameters.

Source

pub async fn set_max_incoming_bitrate( &self, bitrate: u32, ) -> Result<(), RequestError>

Set maximum incoming bitrate for media streams sent by the remote endpoint over this transport.

Source

pub fn tuple(&self) -> TransportTuple

The transport tuple. It refers to both RTP and RTCP since pipe transports use RTCP-mux by design.

§Notes on usage
  • Once the pipe transport is created, transport.tuple() will contain information about its local_address, local_port and protocol.
  • Information about remote_ip and remote_port will be set after calling connect() method.
Source

pub fn sctp_parameters(&self) -> Option<SctpParameters>

Local SCTP parameters. Or None if SCTP is not enabled.

Source

pub fn sctp_state(&self) -> Option<SctpState>

Current SCTP state. Or None if SCTP is not enabled.

Source

pub fn srtp_parameters(&self) -> Option<SrtpParameters>

Local SRTP parameters representing the crypto suite and key material used to encrypt sending RTP and SRTP. Those parameters must be given to the paired PipeTransport in the connect() method.

Source

pub fn on_tuple<F: Fn(&TransportTuple) + Send + Sync + 'static>( &self, callback: F, ) -> HandlerId

Callback is called after the remote RTP origin has been discovered. Only if comedia mode was set.

Source

pub fn on_sctp_state_change<F: Fn(SctpState) + Send + Sync + 'static>( &self, callback: F, ) -> HandlerId

Callback is called when the transport SCTP state changes.

Source

pub fn downgrade(&self) -> WeakPipeTransport

Downgrade PipeTransport to WeakPipeTransport instance.

Trait Implementations§

Source§

impl Clone for PipeTransport

Source§

fn clone(&self) -> PipeTransport

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PipeTransport

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Transport for PipeTransport

Source§

fn id(&self) -> TransportId

Transport id.
Source§

fn router(&self) -> &Router

Router to which transport belongs.
Source§

fn app_data(&self) -> &AppData

Custom application data.
Source§

fn closed(&self) -> bool

Whether the transport is closed.
Source§

fn produce<'life0, 'async_trait>( &'life0 self, producer_options: ProducerOptions, ) -> Pin<Box<dyn Future<Output = Result<Producer, ProduceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Instructs the router to receive audio or video RTP (or SRTP depending on the transport). This is the way to inject media into mediasoup. Read more
Source§

fn consume<'life0, 'async_trait>( &'life0 self, consumer_options: ConsumerOptions, ) -> Pin<Box<dyn Future<Output = Result<Consumer, ConsumeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Instructs the router to send audio or video RTP (or SRTP depending on the transport). This is the way to extract media from mediasoup. Read more
Source§

fn produce_data<'life0, 'async_trait>( &'life0 self, data_producer_options: DataProducerOptions, ) -> Pin<Box<dyn Future<Output = Result<DataProducer, ProduceDataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Instructs the router to receive data messages. Those messages can be delivered by an endpoint via SCTP protocol (AKA DataChannel in WebRTC) or can be directly sent from the Rust application if the transport is a DirectTransport. Read more
Source§

fn consume_data<'life0, 'async_trait>( &'life0 self, data_consumer_options: DataConsumerOptions, ) -> Pin<Box<dyn Future<Output = Result<DataConsumer, ConsumeDataError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Instructs the router to send data messages to the endpoint via SCTP protocol (AKA DataChannel in WebRTC) or directly to the Rust process if the transport is a DirectTransport. Read more
Source§

fn enable_trace_event<'life0, 'async_trait>( &'life0 self, types: Vec<TransportTraceEventType>, ) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Instructs the transport to emit “trace” events. For monitoring purposes. Use with caution.
Source§

fn on_new_producer( &self, callback: Arc<dyn Fn(&Producer) + Send + Sync + 'static>, ) -> HandlerId

Callback is called when a new producer is created.
Source§

fn on_new_consumer( &self, callback: Arc<dyn Fn(&Consumer) + Send + Sync + 'static>, ) -> HandlerId

Callback is called when a new consumer is created.
Source§

fn on_new_data_producer( &self, callback: Arc<dyn Fn(&DataProducer) + Send + Sync + 'static>, ) -> HandlerId

Callback is called when a new data producer is created.
Source§

fn on_new_data_consumer( &self, callback: Arc<dyn Fn(&DataConsumer) + Send + Sync + 'static>, ) -> HandlerId

Callback is called when a new data consumer is created.
Source§

fn on_trace( &self, callback: Arc<dyn Fn(&TransportTraceEventData) + Send + Sync + 'static>, ) -> HandlerId

Source§

fn on_router_close( &self, callback: Box<dyn FnOnce() + Send + 'static>, ) -> HandlerId

Callback is called when the router this transport belongs to is closed for whatever reason. The transport itself is also closed. on_transport_close callbacks are also called on all its producers and consumers.
Source§

fn on_close(&self, callback: Box<dyn FnOnce() + Send + 'static>) -> HandlerId

Callback is called when the router is closed for whatever reason. Read more
Source§

impl TransportGeneric for PipeTransport

Source§

type Stat = PipeTransportStat

Stats data structure specific to each transport.
Source§

fn get_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Stat>, RequestError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns current RTC statistics of the transport. Each transport class produces a different set of statistics.
Source§

fn dump<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Self::Dump, RequestError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dump Transport.

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.