Struct RtmpHandler

Source
pub struct RtmpHandler<RW: AsyncRead + AsyncWrite + Unpin>(/* private fields */);
Expand description

The default RTMP handler.

This handles the raw RTMP by well-known communication steps. That is, this performs just following steps.

§With publishers

  1. Checks the application name from the Connect command.
  2. Checks the topic path from the ReleaseStream/FcPublish command.
  3. Provides a message ID when receives the CreateStream command.
  4. Checks publication informations from the Publish command.
  5. Then receives FLV media data.

If some error occurs in any step, sends commands which are FcUnpublish and DeleteStream to its client, then terminates its connection. These perform to delete the topic path and a message ID from its context. However also these can be sent from clients.

§With subscribers

  1. Checks the application name from the Connect command.
  2. Checks partner’s bandwidsth from the WindowAcknowledgementSize message.
  3. Provides a message ID when receives the CreateStream command.
  4. Checks the topic path from the FcSubscribe command.
  5. Handles one of additional commands either GetStreamLength or SetPlaylist.
  6. Checkes subscription informaitons from Play command/
  7. The sends FLV media data.

In Both sides, if receiving data size exceeds server’s bandwidth, this reports its thing via the Acknowledgement message to its client.

§Examples

use std::marker::PhantomData;
use sheave_core::handlers::{
    RtmpContext,
    VecStream
};
use sheave_server::{
    Server,
    handlers::RtmpHandler,
};

let stream = VecStream::default();
let rtmp_context = RtmpContext::default();
let server = Server::new(stream, rtmp_context, PhantomData::<RtmpHandler<VecStream>>);

Trait Implementations§

Source§

impl<RW: AsyncRead + AsyncWrite + Unpin> AsyncHandler for RtmpHandler<RW>

Source§

fn poll_handle( self: Pin<&mut Self>, cx: &mut FutureContext<'_>, rtmp_context: &mut RtmpContext, ) -> Poll<IOResult<()>>

Source§

impl<RW: Debug + AsyncRead + AsyncWrite + Unpin> Debug for RtmpHandler<RW>

Source§

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

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

impl<RW: AsyncRead + AsyncWrite + Unpin> HandlerConstructor<StreamWrapper<RW>> for RtmpHandler<RW>

Source§

fn new(stream: Arc<StreamWrapper<RW>>) -> Self

Auto Trait Implementations§

§

impl<RW> Freeze for RtmpHandler<RW>

§

impl<RW> RefUnwindSafe for RtmpHandler<RW>
where RW: RefUnwindSafe,

§

impl<RW> Send for RtmpHandler<RW>
where RW: Sync + Send,

§

impl<RW> Sync for RtmpHandler<RW>
where RW: Sync + Send,

§

impl<RW> Unpin for RtmpHandler<RW>

§

impl<RW> UnwindSafe for RtmpHandler<RW>
where RW: RefUnwindSafe,

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<H> AsyncHandlerExt for H
where H: AsyncHandler,

Source§

fn chain<H>(self, next: H) -> Chain<Self, H>
where H: AsyncHandler + Unpin, Self: Sized + Unpin,

Chains this handler with next. Read more
Source§

fn wrap<M>(self, middleware: M) -> Wrap<M, Self>
where M: Middleware + Unpin, Self: Sized + Unpin,

Wraps previous handlers into a middleware. Read more
Source§

fn while_ok<H>(self, body: H) -> WhileOk<Self, H>
where H: AsyncHandler + Unpin, Self: Sized + Unpin,

Loops while the body returns Ok(()) or Pending. Read more
Source§

fn map_err<E>(self, error_handler: E) -> MapErr<Self, E>
where E: ErrorHandler + Unpin, Self: Sized + Unpin,

Handles some error when previous handler returns Err. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,