Skip to main content

Module media

Module media 

Source
Expand description

Real-time audio/video transport bound to a connection (see [citadel_media]) Real-time audio/video transport over a Citadel connection.

Binds the I/O-free [citadel_media] primitives (packetizer, reassembler, jitter buffer, send-queue policy, control messages) to a live connection:

  • Unreliable mode: media fragments travel over the session’s UDP channel (UdpMode::Enabled), control messages over the ordered-reliable channel.
  • Reliable mode (no UDP channel arrived within udp_wait): everything travels over the ordered-reliable channel; the receiver demuxes by wire message type.

Entry point: MediaEndpoint::from_peer_connection / MediaEndpoint::from_c2s, then MediaEndpoint::split.

Dropping a MediaReceiver drops the UDP receive half it owns, which signals PeerSignal::DisconnectUDP to the peer — keep it alive for the lifetime of the call.

Modules§

error
MediaErrorNetworkError mapping. A From impl is impossible here (orphan rule: both types are foreign), so the conversion is a function plus a result-extension trait.

Structs§

MediaEndpoint
A media session bound to one connection. Build with MediaEndpoint::from_peer_connection or MediaEndpoint::from_c2s, then MediaEndpoint::split.
MediaEndpointParts
The two halves of a MediaEndpoint.
MediaReceiver
Inbound half of a media endpoint.
MediaSender
Outbound half of a media endpoint. send_frame is synchronous and never blocks; control messages (announce, end_of_stream) are async.
MediaTransportConfig
Transport tunables for a super::MediaEndpoint. Every field is mandatory (no Default); call MediaTransportConfig::validate before use.
ReliableSink
Sync façade over the ordered-reliable channel: datagrams are queued on an unbounded channel and a pump task forwards them through PeerChannelSendHalf::into_sink. Cloning shares the same pump.

Enums§

MediaEvent
What MediaReceiver::next_event yields.
MediaTransportKind
Which path media fragments take.

Constants§

RECOMMENDED_FRAGMENT_PAYLOAD
Recommended [MediaConfig::max_fragment_payload]: RECOMMENDED_UDP_PAYLOAD_BUDGET - FRAGMENT_HEADER_LEN = 1004, rounded down.
RECOMMENDED_UDP_PAYLOAD_BUDGET
Recommended upper bound on the plaintext bytes handed to the UDP channel per datagram across every transport. Measured floors: the P2P QUIC connection reports a 1162-byte datagram ceiling at spawn (=> 1066 B payload after the 64-byte HDP header + 32-byte AEAD at SecurityLevel::Standard); the raw hole-punched socket allows 1232 B datagrams (=> 1136 B). 1024 fits both with headroom for one extra AEAD layer.

Traits§

MediaDatagramSink
Synchronous, never-blocking datagram sink. Mirrors OutboundUdpSender::unbounded_send: a failure is terminal for that datagram.
MediaDatagramSource
Stream of inbound datagrams (one SecBuffer per wire message).