pub struct MediaDescription {
pub media: String,
pub port: u16,
pub protocol: String,
pub formats: Vec<String>,
pub connection: Option<Connection>,
pub attributes: Vec<Attribute>,
pub other: Vec<(char, String)>,
}Expand description
An m= line and everything under it.
Fields§
§media: Stringaudio, video, application…
port: u16The port. Zero means the stream is rejected — and a rejected stream is still present, which is what keeps the answer’s media lines aligned with the offer’s.
protocol: StringThe transport protocol, such as RTP/AVP.
formats: Vec<String>Payload type numbers, in preference order.
connection: Option<Connection>A c= line for this stream, overriding the session’s.
attributes: Vec<Attribute>Attributes under this media line.
other: Vec<(char, String)>Lines under this media line that this crate does not model, kept so they survive a round trip.
Implementations§
Source§impl MediaDescription
impl MediaDescription
Sourcepub fn audio(port: u16, formats: Vec<String>) -> Self
pub fn audio(port: u16, formats: Vec<String>) -> Self
An audio stream offering these payload types.
Sourcepub fn is_rejected(&self) -> bool
pub fn is_rejected(&self) -> bool
Whether this stream is rejected.
Sourcepub fn direction(&self) -> Direction
pub fn direction(&self) -> Direction
The direction, defaulting to sendrecv when no attribute says otherwise.
Sourcepub fn declared_direction(&self) -> Option<Direction>
pub fn declared_direction(&self) -> Option<Direction>
The direction attribute written under this m= line, if any.
RFC 8866 §6.7: a stream without a direction of its own takes the session-level one,
so an absent attribute is meaningful and not the same thing as sendrecv.
Sourcepub fn set_direction(&mut self, direction: Direction)
pub fn set_direction(&mut self, direction: Direction)
Set the direction, replacing any existing one.
Sourcepub fn crypto(&self) -> Option<Crypto>
pub fn crypto(&self) -> Option<Crypto>
The first a=crypto line this stream carries that sipx can act on (RFC 4568).
Several may be offered, in preference order. sipx takes the first it can perform rather than the first listed: an offer whose favourite suite is one sipx does not implement is still an offer worth answering.
Sourcepub fn fingerprint(&self) -> Option<Fingerprint>
pub fn fingerprint(&self) -> Option<Fingerprint>
The first a=fingerprint this stream carries that sipx may act on (RFC 8122 §5).
§5.1 has an endpoint offer a fingerprint under several hash functions — “the ‘SHA-256’
hash function algorithm and the hash function used to generate the signature on the
certificate” — so more than one line is normal and any of them identifies the same
certificate. Taking the first sipx can compute is therefore correct rather than a shortcut;
the ones it skips are md5 and md2, which §5 forbids acting on.
Looked for on the media description and not the session: a fingerprint may be given at
either level, and the media-level one wins where both appear. A caller that wants the
session-level fallback reads SessionDescription::fingerprint.
Sourcepub fn ice_candidates(&self) -> Vec<Candidate>
pub fn ice_candidates(&self) -> Vec<Candidate>
Every a=candidate under this stream that sipx can act on (RFC 8839 §5.1).
Media-level, and only media-level: §5.1 defines the attribute there and nowhere else.
Lines sipx cannot act on are left out of the result rather than turned into an error — an FQDN, an unsupported address family, a transport other than UDP, an unknown candidate type. §5.1 requires that a candidate be ignored, and ignoring it means ignoring the line: the attribute is still on the description and still round-trips, and the rest of the stream is still usable. A stack that refused the description instead would fail calls with peers doing nothing wrong.
Sourcepub fn ice_remote_candidates(&self) -> Vec<RemoteCandidate>
pub fn ice_remote_candidates(&self) -> Vec<RemoteCandidate>
The a=remote-candidates this stream carries (RFC 8839 §5.2). Media-level.
Present only in an offer from a controlling agent for a stream that is Completed, so an empty result is the normal case rather than a sign of anything.
Sourcepub fn ice_ufrag(&self) -> Option<&str>
pub fn ice_ufrag(&self) -> Option<&str>
This stream’s own a=ice-ufrag (RFC 8839 §5.4), before the session-level default.
Read SessionDescription::ice_credentials_for instead unless the distinction matters:
a stream with no fragment of its own inherits the session’s, and RFC 8839 §4.4.1.1.1
makes the pair of values, not either alone, what an ICE restart changes.
Sourcepub fn ice_pwd(&self) -> Option<&str>
pub fn ice_pwd(&self) -> Option<&str>
This stream’s own a=ice-pwd (RFC 8839 §5.4), before the session-level default.
Sourcepub fn ice_options(&self) -> impl Iterator<Item = &str>
pub fn ice_options(&self) -> impl Iterator<Item = &str>
The option tags this stream advertises (RFC 8839 §5.6).
Sourcepub fn ice_mismatch(&self) -> bool
pub fn ice_mismatch(&self) -> bool
Whether this stream carries a=ice-mismatch (RFC 8839 §5.3). Media-level, in an answer.
It means the offer’s default destination for a component had no matching candidate
attribute, and therefore that ICE MUST NOT be used for this stream — RFC 3264 procedures
apply instead. Not a failure: it is the answerer saying an intermediary rewrote the
addresses, which is what ICE was going to discover the hard way.
Trait Implementations§
Source§impl Clone for MediaDescription
impl Clone for MediaDescription
Source§fn clone(&self) -> MediaDescription
fn clone(&self) -> MediaDescription
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MediaDescription
impl Debug for MediaDescription
Source§impl PartialEq for MediaDescription
impl PartialEq for MediaDescription
Source§fn eq(&self, other: &MediaDescription) -> bool
fn eq(&self, other: &MediaDescription) -> bool
self and other values to be equal, and is used by ==.