Struct mediasoup::plain_transport::PlainTransport [−][src]
A plain transport represents a network path through which RTP, RTCP (optionally secured with SRTP) and SCTP (DataChannel) is transmitted.
Implementations
impl PlainTransport
[src]
pub async fn connect(
&self,
remote_parameters: PlainTransportRemoteParameters
) -> Result<(), RequestError>
[src]
&self,
remote_parameters: PlainTransportRemoteParameters
) -> Result<(), RequestError>
Provide the PlainTransport with remote parameters.
Notes on usage
- If
comedia
is enabled in this plain transport and SRTP is not,connect()
must not be called. - If
comedia
is enabled and SRTP is also enabled (enable_srtp
was set in theRouter::create_plain_transport
options) thenconnect()
must be called with just the remotesrtp_parameters
. - If
comedia
is disabled,connect()
must be eventually called with remoteip
,port
, optionalrtcp_port
(if RTCP-mux is not enabled) and optionalsrtp_parameters
(if SRTP is enabled).
Examples
use mediasoup::plain_transport::PlainTransportRemoteParameters; // Calling connect() on a PlainTransport created with comedia and rtcp_mux set. plain_transport .connect(PlainTransportRemoteParameters { ip: Some("1.2.3.4".parse().unwrap()), port: Some(9998), rtcp_port: None, srtp_parameters: None, }) .await?;
use mediasoup::plain_transport::PlainTransportRemoteParameters; // Calling connect() on a PlainTransport created with comedia unset and rtcp_mux // also unset. plain_transport .connect(PlainTransportRemoteParameters { ip: Some("1.2.3.4".parse().unwrap()), port: Some(9998), rtcp_port: Some(9999), srtp_parameters: None, }) .await?;
use mediasoup::plain_transport::PlainTransportRemoteParameters; use mediasoup::srtp_parameters::{SrtpParameters, SrtpCryptoSuite}; // Calling connect() on a PlainTransport created with comedia set and // enable_srtp enabled. plain_transport .connect(PlainTransportRemoteParameters { ip: None, port: None, rtcp_port: None, srtp_parameters: Some(SrtpParameters { crypto_suite: SrtpCryptoSuite::AesCm128HmacSha180, key_base64: "ZnQ3eWJraDg0d3ZoYzM5cXN1Y2pnaHU5NWxrZTVv".to_string(), }), }) .await?;
use mediasoup::plain_transport::PlainTransportRemoteParameters; use mediasoup::srtp_parameters::{SrtpParameters, SrtpCryptoSuite}; // Calling connect() on a PlainTransport created with comedia unset, rtcpMux // set and enableSrtp enabled. plain_transport .connect(PlainTransportRemoteParameters { ip: Some("1.2.3.4".parse().unwrap()), port: Some(9998), rtcp_port: None, srtp_parameters: Some(SrtpParameters { crypto_suite: SrtpCryptoSuite::AesCm128HmacSha180, key_base64: "ZnQ3eWJraDg0d3ZoYzM5cXN1Y2pnaHU5NWxrZTVv".to_string(), }), }) .await?;
pub async fn set_max_incoming_bitrate(
&self,
bitrate: u32
) -> Result<(), RequestError>
[src]
&self,
bitrate: u32
) -> Result<(), RequestError>
Set maximum incoming bitrate for media streams sent by the remote endpoint over this transport.
pub fn tuple(&self) -> TransportTuple
[src]
The transport tuple. If RTCP-mux is enabled (rtcp_mux
is set), this tuple refers to both
RTP and RTCP.
Notes on usage
- Once the plain transport is created,
transport.tuple()
will contain information about itslocal_ip
,local_port
andprotocol
. - Information about
remote_ip
andremote_port
will be set:- after calling
connect()
method, or - via dynamic remote address detection when using
comedia
mode.
- after calling
pub fn rtcp_tuple(&self) -> Option<TransportTuple>
[src]
The transport tuple for RTCP. If RTCP-mux is enabled (rtcp_mux
is set), its value is
None
.
Notes on usage
- Once the plain transport is created (with RTCP-mux disabled),
transport.rtcp_tuple()
will contain information about itslocal_ip
,local_port
andprotocol
. - Information about
remote_ip
andremote_port
will be set:- after calling
connect()
method, or - via dynamic remote address detection when using
comedia
mode.
- after calling
pub fn sctp_parameters(&self) -> Option<SctpParameters>
[src]
Current SCTP state. Or None
if SCTP is not enabled.
pub fn sctp_state(&self) -> Option<SctpState>
[src]
Current SCTP state. Or None
if SCTP is not enabled.
pub fn srtp_parameters(&self) -> Option<SrtpParameters>
[src]
Local SRTP parameters representing the crypto suite and key material used to encrypt sending
RTP and SRTP. Note that, if comedia
mode is set, these local SRTP parameters may change
after calling connect()
with the remote SRTP parameters (to override the local SRTP crypto
suite with the one given in connect()
).
pub fn on_tuple<F: Fn(&TransportTuple) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called after the remote RTP origin has been discovered. Only if comedia
mode
was set.
pub fn on_rtcp_tuple<F: Fn(&TransportTuple) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called after the remote RTCP origin has been discovered. Only if comedia
mode
was set and rtcp_mux
was not.
pub fn on_sctp_state_change<F: Fn(SctpState) + Send + Sync + 'static>(
&self,
callback: F
) -> HandlerId
[src]
&self,
callback: F
) -> HandlerId
Callback is called when the transport SCTP state changes.
pub fn downgrade(&self) -> WeakPlainTransport
[src]
Downgrade PlainTransport
to WeakPlainTransport
instance.
Trait Implementations
impl Clone for PlainTransport
[src]
fn clone(&self) -> PlainTransport
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for PlainTransport
[src]
impl Transport for PlainTransport
[src]
fn id(&self) -> TransportId
[src]
fn router_id(&self) -> RouterId
[src]
fn app_data(&self) -> &AppData
[src]
fn closed(&self) -> bool
[src]
fn produce<'life0, 'async_trait>(
&'life0 self,
producer_options: ProducerOptions
) -> Pin<Box<dyn Future<Output = Result<Producer, ProduceError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
producer_options: ProducerOptions
) -> Pin<Box<dyn Future<Output = Result<Producer, ProduceError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn consume<'life0, 'async_trait>(
&'life0 self,
consumer_options: ConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<Consumer, ConsumeError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
consumer_options: ConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<Consumer, ConsumeError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn produce_data<'life0, 'async_trait>(
&'life0 self,
data_producer_options: DataProducerOptions
) -> Pin<Box<dyn Future<Output = Result<DataProducer, ProduceDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
data_producer_options: DataProducerOptions
) -> Pin<Box<dyn Future<Output = Result<DataProducer, ProduceDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn consume_data<'life0, 'async_trait>(
&'life0 self,
data_consumer_options: DataConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<DataConsumer, ConsumeDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
data_consumer_options: DataConsumerOptions
) -> Pin<Box<dyn Future<Output = Result<DataConsumer, ConsumeDataError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn enable_trace_event<'life0, 'async_trait>(
&'life0 self,
types: Vec<TransportTraceEventType>
) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
types: Vec<TransportTraceEventType>
) -> Pin<Box<dyn Future<Output = Result<(), RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn on_new_producer(
&self,
callback: Box<dyn Fn(&Producer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&Producer) + Send + Sync + 'static>
) -> HandlerId
fn on_new_consumer(
&self,
callback: Box<dyn Fn(&Consumer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&Consumer) + Send + Sync + 'static>
) -> HandlerId
fn on_new_data_producer(
&self,
callback: Box<dyn Fn(&DataProducer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&DataProducer) + Send + Sync + 'static>
) -> HandlerId
fn on_new_data_consumer(
&self,
callback: Box<dyn Fn(&DataConsumer) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&DataConsumer) + Send + Sync + 'static>
) -> HandlerId
fn on_trace(
&self,
callback: Box<dyn Fn(&TransportTraceEventData) + Send + Sync + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn Fn(&TransportTraceEventData) + Send + Sync + 'static>
) -> HandlerId
fn on_router_close(
&self,
callback: Box<dyn FnOnce() + Send + 'static>
) -> HandlerId
[src]
&self,
callback: Box<dyn FnOnce() + Send + 'static>
) -> HandlerId
fn on_close(&self, callback: Box<dyn FnOnce() + Send + 'static>) -> HandlerId
[src]
impl TransportGeneric for PlainTransport
[src]
type Dump = PlainTransportDump
type Stat = PlainTransportStat
Stats data structure specific to each transport.
fn get_stats<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Stat>, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Stat>, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
#[must_use]fn dump<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Dump, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Dump, RequestError>> + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations
impl !RefUnwindSafe for PlainTransport
impl Send for PlainTransport
impl Sync for PlainTransport
impl Unpin for PlainTransport
impl !UnwindSafe for PlainTransport
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,