Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
roc::packet Namespace Reference

Network packets and packet processing. More...

Classes

class  ConcurrentQueue
 Concurrent blocking packet queue. More...
 
class  DelayedReader
 Delayed reader. More...
 
struct  FEC
 FECFRAME packet. More...
 
class  IComposer
 Packet composer interface. More...
 
class  Interleaver
 Interleaves packets to transmit them in pseudo random order. More...
 
class  IParser
 Packet parser interface. More...
 
class  IReader
 Packet reader interface. More...
 
class  IWriter
 Packet writer interface. More...
 
class  Packet
 Packet. More...
 
class  PacketFactory
 Packet factory. More...
 
class  Queue
 Packet queue. More...
 
class  Router
 Route packets to writers. More...
 
struct  RTCP
 RTCP compound packet. More...
 
struct  RTP
 RTP packet. More...
 
class  SortedQueue
 Sorted packet queue. More...
 
struct  UDP
 UDP packet. More...
 

Typedefs

typedef core::SharedPtr< PacketPacketPtr
 Packet smart pointer.
 
typedef uint32_t source_t
 Packet source ID identifying packet stream.
 
typedef uint32_t timestamp_t
 Audio packet timestamp.
 
typedef int32_t timestamp_diff_t
 Audio packet timestamps difference.
 
typedef uint16_t seqnum_t
 Packet sequence number in packet stream.
 
typedef int16_t seqnum_diff_t
 Packet sequence numbers difference.
 
typedef uint16_t blknum_t
 FEC block number in a packet stream.
 
typedef int16_t blknum_diff_t
 FEC block numbers difference.
 
typedef uint64_t ntp_timestamp_t
 NTP timestamp.
 
typedef uint32_t channel_mask_t
 Bitmask of channels present in audio packet.
 

Enumerations

enum  FecScheme { FEC_None , FEC_ReedSolomon_M8 , FEC_LDPC_Staircase }
 FECFRAME scheme. More...
 
enum  { PrintPayload = (1 << 0) }
 Print flags. More...
 

Functions

const char * fec_scheme_to_str (FecScheme)
 FEC scheme to string.
 
packet::ntp_timestamp_t ntp_timestamp ()
 Get current NTP time.
 
bool ntp_equal_delta (ntp_timestamp_t a, ntp_timestamp_t b, ntp_timestamp_t delta)
 Compares a and b if they close enough.
 
ntp_timestamp_t nanoseconds_2_ntp (core::nanoseconds_t ns)
 Converts nanoseconds to ntp timestamp.
 
core::nanoseconds_t ntp_2_nanoseconds (ntp_timestamp_t ts)
 Converts ntp timestamp to nanoseconds.
 
void print_packet (const Packet &packet, int flags)
 Print packet to stderr.
 
timestamp_diff_t timestamp_diff (timestamp_t a, timestamp_t b)
 Compute difference between two timestamps.
 
bool timestamp_lt (timestamp_t a, timestamp_t b)
 Check if a is before b taking possible wrap into account.
 
bool timestamp_le (timestamp_t a, timestamp_t b)
 Check if a is before or equal to b taking possible wrap into account.
 
seqnum_diff_t seqnum_diff (seqnum_t a, seqnum_t b)
 Compute difference between two seqnums.
 
bool seqnum_lt (seqnum_t a, seqnum_t b)
 Check if a is before b taking possible wrap into account.
 
bool seqnum_le (seqnum_t a, seqnum_t b)
 Check if a is before or equal to b taking possible wrap into account.
 
blknum_diff_t blknum_diff (blknum_t a, blknum_t b)
 Compute difference between two FEC block numbers.
 
bool blknum_lt (blknum_t a, blknum_t b)
 Check if a is before b taking possible wrap into account.
 
bool blknum_le (blknum_t a, blknum_t b)
 Check if a is before or equal to b taking possible wrap into account.
 
size_t num_channels (channel_mask_t ch_mask)
 Compute number of channels in mask.
 

Detailed Description

Network packets and packet processing.

Typedef Documentation

◆ blknum_diff_t

typedef int16_t roc::packet::blknum_diff_t

FEC block numbers difference.

Definition at line 70 of file units.h.

◆ blknum_t

typedef uint16_t roc::packet::blknum_t

FEC block number in a packet stream.

Definition at line 67 of file units.h.

◆ channel_mask_t

typedef uint32_t roc::packet::channel_mask_t

Bitmask of channels present in audio packet.

Definition at line 94 of file units.h.

◆ ntp_timestamp_t

typedef uint64_t roc::packet::ntp_timestamp_t

NTP timestamp.

Remarks
Highest 32 bits - seconds since NTP epoch, lowest 32 bits - fractions of a second. NTP epoch starts from January 1, 1900.

Definition at line 91 of file units.h.

◆ PacketPtr

Packet smart pointer.

Definition at line 33 of file packet.h.

◆ seqnum_diff_t

typedef int16_t roc::packet::seqnum_diff_t

Packet sequence numbers difference.

Definition at line 49 of file units.h.

◆ seqnum_t

typedef uint16_t roc::packet::seqnum_t

Packet sequence number in packet stream.

Definition at line 46 of file units.h.

◆ source_t

typedef uint32_t roc::packet::source_t

Packet source ID identifying packet stream.

Definition at line 22 of file units.h.

◆ timestamp_diff_t

Audio packet timestamps difference.

Definition at line 28 of file units.h.

◆ timestamp_t

typedef uint32_t roc::packet::timestamp_t

Audio packet timestamp.

Definition at line 25 of file units.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Print flags.

Enumerator
PrintPayload 

Print packet payload.

Definition at line 21 of file print_packet.h.

◆ FecScheme

FECFRAME scheme.

Enumerator
FEC_None 

No FEC.

FEC_ReedSolomon_M8 

Reed-Solomon (m=8).

FEC_LDPC_Staircase 

LDPC-Staircase.

Definition at line 23 of file fec.h.

Function Documentation

◆ blknum_diff()

blknum_diff_t roc::packet::blknum_diff ( blknum_t  a,
blknum_t  b 
)
inline

Compute difference between two FEC block numbers.

Definition at line 73 of file units.h.

◆ blknum_le()

bool roc::packet::blknum_le ( blknum_t  a,
blknum_t  b 
)
inline

Check if a is before or equal to b taking possible wrap into account.

Definition at line 83 of file units.h.

◆ blknum_lt()

bool roc::packet::blknum_lt ( blknum_t  a,
blknum_t  b 
)
inline

Check if a is before b taking possible wrap into account.

Definition at line 78 of file units.h.

◆ fec_scheme_to_str()

const char * roc::packet::fec_scheme_to_str ( FecScheme  )

FEC scheme to string.

◆ nanoseconds_2_ntp()

ntp_timestamp_t roc::packet::nanoseconds_2_ntp ( core::nanoseconds_t  ns)

Converts nanoseconds to ntp timestamp.

Parameters
nsmust be non-negative.
Remarks
Warning: for deltas only, since NTP epoch represnted in nanoseconds could not fit into 64 bits.

◆ ntp_2_nanoseconds()

core::nanoseconds_t roc::packet::ntp_2_nanoseconds ( ntp_timestamp_t  ts)

Converts ntp timestamp to nanoseconds.

Remarks
Warning: for deltas only, since NTP epoch represented in nanoseconds could not fit into 64 bits.

◆ ntp_equal_delta()

bool roc::packet::ntp_equal_delta ( ntp_timestamp_t  a,
ntp_timestamp_t  b,
ntp_timestamp_t  delta 
)

Compares a and b if they close enough.

◆ ntp_timestamp()

packet::ntp_timestamp_t roc::packet::ntp_timestamp ( )

Get current NTP time.

◆ num_channels()

size_t roc::packet::num_channels ( channel_mask_t  ch_mask)
inline

Compute number of channels in mask.

Definition at line 97 of file units.h.

◆ print_packet()

void roc::packet::print_packet ( const Packet packet,
int  flags 
)

Print packet to stderr.

◆ seqnum_diff()

seqnum_diff_t roc::packet::seqnum_diff ( seqnum_t  a,
seqnum_t  b 
)
inline

Compute difference between two seqnums.

Definition at line 52 of file units.h.

◆ seqnum_le()

bool roc::packet::seqnum_le ( seqnum_t  a,
seqnum_t  b 
)
inline

Check if a is before or equal to b taking possible wrap into account.

Definition at line 62 of file units.h.

◆ seqnum_lt()

bool roc::packet::seqnum_lt ( seqnum_t  a,
seqnum_t  b 
)
inline

Check if a is before b taking possible wrap into account.

Definition at line 57 of file units.h.

◆ timestamp_diff()

timestamp_diff_t roc::packet::timestamp_diff ( timestamp_t  a,
timestamp_t  b 
)
inline

Compute difference between two timestamps.

Definition at line 31 of file units.h.

◆ timestamp_le()

bool roc::packet::timestamp_le ( timestamp_t  a,
timestamp_t  b 
)
inline

Check if a is before or equal to b taking possible wrap into account.

Definition at line 41 of file units.h.

◆ timestamp_lt()

bool roc::packet::timestamp_lt ( timestamp_t  a,
timestamp_t  b 
)
inline

Check if a is before b taking possible wrap into account.

Definition at line 36 of file units.h.