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.
§As a publisher
- Specifies the application name via the
Connect
command. - Specifies the topic path via the
ReleaseStream
/FcPublish
command. - Requests a message ID via the
CreateStream
command. - Specifies publication informations via the
Publish
command. - Then sends FLV media data.
If some error occurs in any step, sends commands which are FcUnpublish
and DeleteStream
to its server, 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 servers.
§As a subscriber
- Specifies the application name via the
Connect
command. - Tells the size of receiving bandwidth via the
WindowAcknowledgementSize
message. - Requests a message ID via the
CreateStream
command. - Specified the topic path via the
FcSubscribe
command. - Following additional command may be required.
- Requests the duration of its topic via the
GetStreamLength
command. (in FFmpeg) - Requests a list of topics as a playlist via the
SetPlaylist
command. (in OBS)
- Requests the duration of its topic via the
- Specifies subscription information via the
Play
command. - Specifies a time range to buffer its topic via the
SetBufferLength
event. - Then receives FLV media data.
If receiving data size exceeds client’s bandwidth, this reports its thing via the Acknowledgement
message to its server.
§Examples
use std::marker::PhantomData;
use sheave_core::handlers::{
RtmpContext,
VecStream
};
use sheave_client::{
Client,
handlers::RtmpHandler,
};
let stream = VecStream::default();
let rtmp_context = RtmpContext::default();
let client = Client::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