pub struct RtmpPacketSource { /* private fields */ }Expand description
PacketSource wrapping an RtmpSession.
Constructed by open_rtmp (the registry opener) or directly
from a session via RtmpPacketSource::from_session — the
latter is useful for callers driving their own
RtmpServer::accept loop who want the typed-packet
conversion without the listen-and-validate flow.
Implementations§
Source§impl RtmpPacketSource
impl RtmpPacketSource
Sourcepub fn from_session(session: RtmpSession) -> Self
pub fn from_session(session: RtmpSession) -> Self
Wrap a freshly-accepted RtmpSession without any
probing — streams() will be empty until the first audio
/ video packet flows. Suitable for callers who already
know the stream shape (e.g. they are also the publisher).
Sourcepub fn from_session_with_probe(
session: RtmpSession,
read_timeout: Option<Duration>,
) -> RtmpResult<Self>
pub fn from_session_with_probe( session: RtmpSession, read_timeout: Option<Duration>, ) -> RtmpResult<Self>
Wrap a session and run the probing loop now: read up to
PROBE_LIMIT packets, populate streams() with the
observed audio + video codec ids, and buffer those packets
for later next_packet calls.
read_timeout bounds individual reads so a publisher that
only ever sends one stream-type doesn’t stall probing
indefinitely. None keeps the socket blocking with no
timeout — only safe when the caller knows the publisher
will eventually send both kinds.
Sourcepub fn session(&self) -> &RtmpSession
pub fn session(&self) -> &RtmpSession
Borrow the wrapped session for advanced operations
(set_read_timeout, peer_addr, …). Reading directly
would interfere with the PacketSource machinery; prefer
inspection-only methods.
Trait Implementations§
Source§impl PacketSource for RtmpPacketSource
impl PacketSource for RtmpPacketSource
Source§fn streams(&self) -> &[StreamInfo]
fn streams(&self) -> &[StreamInfo]
Source§fn next_packet(&mut self) -> CoreResult<Packet>
fn next_packet(&mut self) -> CoreResult<Packet>
Error::Eof at
end of stream.Source§fn metadata(&self) -> &[(String, String)]
fn metadata(&self) -> &[(String, String)]
Source§fn duration_micros(&self) -> Option<i64>
fn duration_micros(&self) -> Option<i64>
None. Live sources (RTMP push, etc.) typically return None.