pub struct MediaData {
pub mid: Mid,
pub pt: Pt,
pub rid: Option<Rid>,
pub params: PayloadParams,
pub time: MediaTime,
pub network_time: Instant,
pub contiguous: bool,
pub data: Vec<u8>,
pub ext_vals: ExtensionValues,
pub meta: Vec<RtpMeta>,
pub codec_extra: CodecExtra,
}
Expand description
Video or audio data from the remote peer.
This is obtained via Event::MediaData
.
Fields§
§mid: Mid
Identifier of the m-line in the SDP this media belongs to.
pt: Pt
Payload type (PT) tells which negotiated codec is being used. An m-line can carry different codecs, the payload type can theoretically change from one packet to the next.
rid: Option<Rid>
Rtp Stream Id (RID) identifies an RTP stream without refering to its Synchronization Source (SSRC).
This is a newer standard that is sometimes used in WebRTC to identify a stream. Specifically when using Simulcast in Chrome.
params: PayloadParams
Parameters for the codec. This is used to match incoming PT to ougoing PT.
time: MediaTime
The RTP media time of this packet. Media time is described as a nominator/denominator quantity. The nominator is the timestamp field from the RTP header, the denominator depends on whether this is an audio or video packet.
For audio the timebase is 48kHz for video it is 90kHz.
network_time: Instant
The time of the Input::Receive
that caused this MediaData.
In simple SFU setups this can be used as wallclock for Writer::write
.
contiguous: bool
Whether the data is contiguous from the one just previously emitted. If this is false, we got an interruption in RTP packets, and the data may or may not be usable in a decoder without requesting a new keyframe.
For audio this flag most likely doesn’t matter.
data: Vec<u8>
The actual packet data a.k.a Sample.
Bigger samples don’t fit in one UDP packet, thus WebRTC RTP is chopping up codec transmission units into smaller parts.
This data is a full depacketized Sample.
ext_vals: ExtensionValues
RTP header extensions for this media data. This is taken from the first RTP header.
meta: Vec<RtpMeta>
The individual packet metadata that were part of making the Sample in data
.
codec_extra: CodecExtra
Additional codec specific information