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
- Checks the application name from the
Connectcommand. - Checks the topic path from the
ReleaseStream/FcPublishcommand. - Provides a message ID when receives the
CreateStreamcommand. - Checks publication informations from the
Publishcommand. - 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
- Checks the application name from the
Connectcommand. - Checks partner’s bandwidsth from the
WindowAcknowledgementSizemessage. - Provides a message ID when receives the
CreateStreamcommand. - Checks the topic path from the
FcSubscribecommand. - Handles one of additional commands either
GetStreamLengthorSetPlaylist. - Checkes subscription informaitons from
Playcommand/ - 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>
impl<RW: AsyncRead + AsyncWrite + Unpin> AsyncHandler for RtmpHandler<RW>
fn poll_handle( self: Pin<&mut Self>, cx: &mut FutureContext<'_>, rtmp_context: &mut RtmpContext, ) -> Poll<IOResult<()>>
Source§impl<RW: AsyncRead + AsyncWrite + Unpin> HandlerConstructor<StreamWrapper<RW>> for RtmpHandler<RW>
impl<RW: AsyncRead + AsyncWrite + Unpin> HandlerConstructor<StreamWrapper<RW>> for RtmpHandler<RW>
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>
impl<RW> Sync for RtmpHandler<RW>
impl<RW> Unpin for RtmpHandler<RW>
impl<RW> UnwindSafe for RtmpHandler<RW>where
RW: RefUnwindSafe,
Blanket Implementations§
Source§impl<H> AsyncHandlerExt for Hwhere
H: AsyncHandler,
impl<H> AsyncHandlerExt for Hwhere
H: AsyncHandler,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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