pub struct Config {Show 13 fields
pub remote: SocketAddr,
pub codec: Codec,
pub payload_type: Option<u8>,
pub receive_payload_type: Option<u8>,
pub channels: usize,
pub srtp: Option<SrtpKeys>,
pub packet_duration: Duration,
pub clock_rate: u32,
pub jitter_depth: usize,
pub jitter_max_depth: Option<usize>,
pub rtcp_interval: Option<Duration>,
pub rtcp_mode: RtcpMode,
pub dtmf_payload_type: Option<u8>,
}Expand description
How a session is configured.
Fields§
§remote: SocketAddrWhere to send until symmetric RTP learns better.
codec: CodecWhich codec.
payload_type: Option<u8>The payload type to send with, when the codec’s own is not the negotiated one.
None uses Codec::payload_type. A dynamic codec has no number of its own — Opus
has none at all (RFC 7587 §7) — so the number comes from the a=rtpmap the two sides
agreed on, and it may differ from the one sipx would have proposed. Assuming otherwise
sends audio on a number the far end has assigned to something else.
receive_payload_type: Option<u8>The payload type accepted for this codec when our description assigned a different dynamic number from the peer’s.
None mirrors Self::wire_payload_type, which preserves the ordinary symmetric case.
Offer/answer may nevertheless assign the same codec independently in each direction:
outgoing packets use the peer’s number and incoming packets use ours (RFC 3264 §6.1).
channels: usizeHow many channels the codec carries. One, for telephony.
srtp: Option<SrtpKeys>SRTP keys, if the media is to be encrypted (RFC 3711).
None sends and expects plain RTP. There is deliberately no middle setting — no “accept
either” — because a session that falls back to cleartext when a packet fails to
authenticate is a session an attacker can downgrade by sending one bad packet.
packet_duration: DurationHow much audio each packet carries. 20 ms is universal; values below 1 ms are rejected
by Self::validate and every session-start API.
clock_rate: u32RTP-clock samples per second for the exact negotiated format.
G.711 is always 8000; L16 may use its static 44100 clock or a dynamically mapped rate.
jitter_depth: usizeHow many packets the jitter buffer holds, and never fewer.
jitter_max_depth: Option<usize>The deepest it may grow when the network misbehaves, in packets.
None fixes the depth at Self::jitter_depth, which is what the comparison tests in
sipx-rtp measure the adaptive buffer against. Adapting is the default because being
too shallow is audible and being too deep is not — but the ceiling is a real ceiling: a
call with a quarter-second of delay is still a call, and one with three seconds is not.
rtcp_interval: Option<Duration>How often to send RTCP receiver reports. None disables RTCP entirely; a configured
interval must be at least 1 ms.
RFC 3550 §6.2 scales the interval with the session’s bandwidth and membership; for a two-party call that arithmetic lands at the five-second minimum, so sipx uses it directly rather than implementing a calculation that would always return the same answer.
rtcp_mode: RtcpModeWhether RTCP uses the RTP socket or its adjacent control socket (RFC 5761).
dtmf_payload_type: Option<u8>The payload type carrying telephone-event, if the SDP negotiated one.
It is dynamic, so the number is whatever the answer said — assuming 101 because that is what sipx offers would decode another endpoint’s codec as keypresses.
Implementations§
Source§impl Config
impl Config
Sourcepub fn wire_payload_type(&self) -> u8
pub fn wire_payload_type(&self) -> u8
The payload type this session puts on the wire.
Sourcepub fn receive_wire_payload_type(&self) -> u8
pub fn receive_wire_payload_type(&self) -> u8
The payload type this session accepts for its negotiated codec.
Sourcepub fn new(remote: SocketAddr, codec: Codec) -> Self
pub fn new(remote: SocketAddr, codec: Codec) -> Self
A session to a peer in this codec, with the settings everything uses.
Sourcepub fn samples_per_packet(&self) -> usize
pub fn samples_per_packet(&self) -> usize
How many samples one packet carries.
Sourcepub fn validate(&self) -> Result<(), SetupError>
pub fn validate(&self) -> Result<(), SetupError>
Check the values used by worker timers before any worker or socket starts.
§Errors
Returns SetupError::PacketDurationTooShort or
SetupError::RtcpIntervalTooShort for a duration below one millisecond.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
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>
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