Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::packet::Packet Class Reference

Packet. More...

#include <packet.h>

Inheritance diagram for roc::packet::Packet:
Collaboration diagram for roc::packet::Packet:

Public Types

enum  {
  FlagUDP = (1 << 0) , FlagRTP = (1 << 1) , FlagFEC = (1 << 2) , FlagRTCP = (1 << 3) ,
  FlagAudio = (1 << 4) , FlagRepair = (1 << 5) , FlagControl = (1 << 6) , FlagPrepared = (1 << 7) ,
  FlagComposed = (1 << 8) , FlagRestored = (1 << 9)
}
 Packet flags. More...
 

Public Member Functions

 Packet (core::IPool &packet_pool)
 Constructor. More...
 
void add_flags (unsigned flags)
 Add flags. More...
 
bool has_flags (unsigned flags) const
 Check specific flag. More...
 
unsigned flags () const
 Get flags. More...
 
const UDPudp () const
 UDP packet. More...
 
UDPudp ()
 UDP packet. More...
 
const RTPrtp () const
 RTP packet. More...
 
RTPrtp ()
 RTP packet. More...
 
const FECfec () const
 FEC packet. More...
 
FECfec ()
 FEC packet. More...
 
const RTCPrtcp () const
 RTCP packet. More...
 
RTCPrtcp ()
 RTCP packet. More...
 
const core::Slice< uint8_t > & data () const
 Get packet data. More...
 
void set_data (const core::Slice< uint8_t > &data)
 Set packet data. More...
 
stream_source_t source () const
 Return packet stream identifier. More...
 
stream_timestamp_t begin () const
 Get the timestamp of the first sample in packet. More...
 
stream_timestamp_t end () const
 Get the timestamp of the last sample in packet plus one. More...
 
int compare (const Packet &other) const
 Determine packet order. More...
 
void print (int flags) const
 Print packet to stderr. More...
 
- Public Member Functions inherited from roc::core::RefCounted< Packet, core::PoolAllocation >
 RefCounted ()
 Initialize. More...
 
 RefCounted (const core::PoolAllocation &policy)
 Initialize. More...
 
int getref () const
 Get reference counter. More...
 
void incref () const
 Increment reference counter. More...
 
void decref () const
 Decrement reference counter. More...
 
- Public Member Functions inherited from roc::core::ListNode
ListNodeDatalist_node_data () const
 Get list node data. More...
 
- Public Member Functions inherited from roc::core::MpscQueueNode
MpscQueueDatampsc_queue_data () const
 Get list node data. More...
 

Static Public Member Functions

static Packetcontainer_of (UDP *udp)
 Get pointer to packet from a pointer to its UDP part. More...
 

Additional Inherited Members

- Protected Member Functions inherited from roc::core::PoolAllocation
IPoolpool () const
 Get pool. More...
 
 PoolAllocation (IPool &pool)
 Initialize. More...
 
template<class T >
void destroy (T &object)
 Destroy object and return memory to pool. More...
 

Detailed Description

Packet.

Definition at line 36 of file packet.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Packet flags.

Enumerator
FlagUDP 

Packet contains UDP header.

FlagRTP 

Packet contains RTP header.

FlagFEC 

Packet contains FEC header.

FlagRTCP 

Packet contains RTCP compound packet.

FlagAudio 

Packet contains audio samples.

FlagRepair 

Packet contains repair FEC symbols.

FlagControl 

Packet contains control message.

FlagPrepared 

Packet was prepared for composing.

FlagComposed 

Packet was composed.

FlagRestored 

Packet was restored using FEC decoder.

Definition at line 44 of file packet.h.

Constructor & Destructor Documentation

◆ Packet()

roc::packet::Packet::Packet ( core::IPool packet_pool)
explicit

Constructor.

Member Function Documentation

◆ add_flags()

void roc::packet::Packet::add_flags ( unsigned  flags)

Add flags.

◆ begin()

stream_timestamp_t roc::packet::Packet::begin ( ) const

Get the timestamp of the first sample in packet.

Remarks
Timestamp units depend on packet type. For some packet types, may be always zero.

◆ compare()

int roc::packet::Packet::compare ( const Packet other) const

Determine packet order.

Returns
  • -1 if this packet precedes other packet
  • 0 if this packet has the same position as other packet
  • +1 if this packet succeeds other packet

◆ container_of()

static Packet* roc::packet::Packet::container_of ( UDP udp)
inlinestatic

Get pointer to packet from a pointer to its UDP part.

Definition at line 127 of file packet.h.

◆ data()

const core::Slice<uint8_t>& roc::packet::Packet::data ( ) const

Get packet data.

◆ end()

stream_timestamp_t roc::packet::Packet::end ( ) const

Get the timestamp of the last sample in packet plus one.

Remarks
Timestamp units depend on packet type. For some packet types, may be always zero.

◆ fec() [1/2]

FEC* roc::packet::Packet::fec ( )

FEC packet.

◆ fec() [2/2]

const FEC* roc::packet::Packet::fec ( ) const

FEC packet.

◆ flags()

unsigned roc::packet::Packet::flags ( ) const

Get flags.

◆ has_flags()

bool roc::packet::Packet::has_flags ( unsigned  flags) const

Check specific flag.

◆ print()

void roc::packet::Packet::print ( int  flags) const
inline

Print packet to stderr.

Definition at line 122 of file packet.h.

◆ rtcp() [1/2]

RTCP* roc::packet::Packet::rtcp ( )

RTCP packet.

◆ rtcp() [2/2]

const RTCP* roc::packet::Packet::rtcp ( ) const

RTCP packet.

◆ rtp() [1/2]

RTP* roc::packet::Packet::rtp ( )

RTP packet.

◆ rtp() [2/2]

const RTP* roc::packet::Packet::rtp ( ) const

RTP packet.

◆ set_data()

void roc::packet::Packet::set_data ( const core::Slice< uint8_t > &  data)

Set packet data.

◆ source()

stream_source_t roc::packet::Packet::source ( ) const

Return packet stream identifier.

Remarks
The returning value depends on packet type. For some packet types, may be always zero.

◆ udp() [1/2]

UDP* roc::packet::Packet::udp ( )

UDP packet.

◆ udp() [2/2]

const UDP* roc::packet::Packet::udp ( ) const

UDP packet.


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