Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::packet::RTP Struct Reference

RTP packet. More...

#include <rtp.h>

Collaboration diagram for roc::packet::RTP:

Public Member Functions

 RTP ()
 Construct zero RTP packet. More...
 
int compare (const RTP &) const
 Determine packet order. More...
 

Public Attributes

stream_source_t source
 Packet source ID identifying packet stream ("src"). More...
 
seqnum_t seqnum
 Packet sequence number in packet stream ("sn"). More...
 
stream_timestamp_t stream_timestamp
 Packet stream timestamp ("sts"). More...
 
stream_timestamp_t duration
 Packet duration ("dur"). More...
 
core::nanoseconds_t capture_timestamp
 Packet capture timestamp ("cts"). More...
 
bool marker
 Packet marker bit ("m"). More...
 
unsigned int payload_type
 Packet payload type ("pt"). More...
 
core::Slice< uint8_t > header
 Packet header. More...
 
core::Slice< uint8_t > payload
 Packet payload. More...
 
core::Slice< uint8_t > padding
 Packet padding. More...
 

Detailed Description

RTP packet.

Definition at line 24 of file rtp.h.

Constructor & Destructor Documentation

◆ RTP()

roc::packet::RTP::RTP ( )

Construct zero RTP packet.

Member Function Documentation

◆ compare()

int roc::packet::RTP::compare ( const RTP ) const

Determine packet order.

Member Data Documentation

◆ capture_timestamp

core::nanoseconds_t roc::packet::RTP::capture_timestamp

Packet capture timestamp ("cts").

Remarks
Describes capture time of the first sample using local Unix-time clock. This clock belongs to local system, no matter if we're on sender or receiver. On sender, capture timestamp is assigned to the system time of sender when the first sample in the packet was captured. On receiver, capture timestamp is assigned an estimation of the same value, converted to receiver system clock, i.e. the system time of receiver when the first sample in the packet was captured on sender. This field does not directly correspond to anything inside RTP packet. Instead, receiver deduces this value based on "timestamp" field from RTP packet, current NTP time, and mapping of NTP timestamps to RTP timestamps retrieved via RTCP.

Definition at line 68 of file rtp.h.

◆ duration

stream_timestamp_t roc::packet::RTP::duration

Packet duration ("dur").

Remarks
Duration is measured in the same units as timestamp. Duration is not stored directly in RTP header. It is calculated from packet size.

Definition at line 53 of file rtp.h.

◆ header

core::Slice<uint8_t> roc::packet::RTP::header

Packet header.

Definition at line 79 of file rtp.h.

◆ marker

bool roc::packet::RTP::marker

Packet marker bit ("m").

Remarks
Marker bit meaning depends on packet type.

Definition at line 73 of file rtp.h.

◆ padding

core::Slice<uint8_t> roc::packet::RTP::padding

Packet padding.

Remarks
Not included in header and payload, but affects overall packet size.

Definition at line 89 of file rtp.h.

◆ payload

core::Slice<uint8_t> roc::packet::RTP::payload

Packet payload.

Remarks
Doesn't include RTP headers and padding.

Definition at line 84 of file rtp.h.

◆ payload_type

unsigned int roc::packet::RTP::payload_type

Packet payload type ("pt").

Definition at line 76 of file rtp.h.

◆ seqnum

seqnum_t roc::packet::RTP::seqnum

Packet sequence number in packet stream ("sn").

Remarks
Packets are numbered sequentaly in every stream, starting from some random value. May overflow.

Definition at line 35 of file rtp.h.

◆ source

stream_source_t roc::packet::RTP::source

Packet source ID identifying packet stream ("src").

Remarks
Sequence numbers and timestamp are numbered independently inside different packet streams.

Definition at line 29 of file rtp.h.

◆ stream_timestamp

stream_timestamp_t roc::packet::RTP::stream_timestamp

Packet stream timestamp ("sts").

Remarks
Describes position of the first sample using abstract stream clock. This clock belongs to sender and has sample rate of the stream. For example, if sender is 44100Hz audio card, then stream timestamp is incremented by one each generated sample, and it happens 44100 times per second, according to audio card clock. This timestamp corresponds to "timestamp" field of RTP packet. Just like seqnum, it starts from random value and may overflow.

Definition at line 46 of file rtp.h.


The documentation for this struct was generated from the following file: