Struct mediasoup::direct_transport::DirectTransport[][src]

pub struct DirectTransport { /* fields omitted */ }

A direct transport represents a direct connection between the mediasoup Rust process and a Router instance in a mediasoup-worker thread.

A direct transport can be used to directly send and receive data messages from/to Rust by means of DataProducers and DataConsumers of type Direct created on a direct transport. Direct messages sent by a DataProducer in a direct transport can be consumed by endpoints connected through a SCTP capable transport (WebRtcTransport, PlainTransport, PipeTransport and also by the Rust application by means of a DataConsumer created on a DirectTransport (and vice-versa: messages sent over SCTP/DataChannel can be consumed by the Rust application by means of a DataConsumer created on a DirectTransport).

A direct transport can also be used to inject and directly consume RTP and RTCP packets in Rust by using the DirectProducer::send and Consumer::on_rtp API (plus DirectTransport::send_rtcp and DirectTransport::on_rtcp API).

Implementations

impl DirectTransport[src]

pub async fn send_rtcp(
    &self,
    rtcp_packet: Bytes
) -> Result<(), NotificationError>
[src]

Send a RTCP packet from the Rust process.

  • rtcp_packet - Bytes containing a valid RTCP packet (can be a compound packet).

pub fn on_rtcp<F: Fn(&Bytes) + Send + Sync + 'static>(
    &self,
    callback: F
) -> HandlerId
[src]

Callback is called when the direct transport receives a RTCP packet from its router.

pub fn downgrade(&self) -> WeakDirectTransport[src]

Downgrade DirectTransport to WeakDirectTransport instance.

Trait Implementations

impl Clone for DirectTransport[src]

impl Debug for DirectTransport[src]

impl Transport for DirectTransport[src]

fn id(&self) -> TransportId[src]

Transport id.

fn app_data(&self) -> &AppData[src]

Custom application data.

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]

Create a Producer.

Transport will be kept alive as long as at least one producer instance is alive.

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]

Create a Consumer.

Transport will be kept alive as long as at least one consumer instance is alive.

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]

Create a DataProducer.

Transport will be kept alive as long as at least one data producer instance is alive.

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]

Create a DataConsumer.

Transport will be kept alive as long as at least one data consumer instance is alive.

impl TransportGeneric for DirectTransport[src]

type Dump = DirectTransportDump

type Stat = DirectTransportStat

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]

Returns current RTC statistics of the transport.

Check the RTC Statistics section for more details (TypeScript-oriented, but concepts apply here as well).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.