Skip to main content

Module session

Module session 

Source
Expand description

str0m session driver shared by every HTTP role / media direction.

str0m is sans-IO, so we drive the str0m::Rtc instance from a tokio task that owns a UDP socket. Session::run alternates between Rtc::poll_output (drain pending transmits / events) and Rtc::handle_input (feed UDP packets or timeouts).

The session itself doesn’t care whether the Rtc was populated by accepting an SDP offer (server side) or by minting one and posting it to a remote URL (client side), or whether the media flow is RTP-in (MediaSink) or RTP-out (crate::egress::EgressSource).

Structs§

Session
Drives a Rtc instance until it ends.

Enums§

MediaRole
What the session does with the negotiated media stream.

Traits§

MediaSink
Receives MediaData events from str0m and dispatches to the right codec Bridge. Used as the per-session sink in Session::run for any flow where RTP arrives from the peer (server publish / WHIP server, client subscribe / WHEP client).

Functions§

bind_udp
Bind an ephemeral UDP socket for a single client session and return it (shared with its reader task) plus the ICE candidates to advertise.
rtc_config_with_codecs
Build a Rtc with CodecConfig restricted to the supplied codecs.
rtc_with_codecs
Build a codec-restricted Rtc for the client egress path (which lets str0m mint its own ICE credentials). The server egress path uses rtc_config_with_codecs directly so it can inject the mux’s known credentials before building.
spawn_socket_reader
Spawn a 1:1 reader pumping every datagram from socket into a channel, for the client paths (one socket per session, so no demux is needed). Mirrors the inbound side of crate::server::mux for a single session.