sheave_server::handlers

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.

  1. Checks the application name from the Connect command.
  2. Checks the playpath 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 receiving data size exceeds server’s bandwidth, this reports its thing via the Acknowledgement message to its client. And 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 playpath and a message ID from its context. However also these can be sent from clients.

§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.

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> 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