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

Packet. More...

#include <packet.h>

Inheritance diagram for roc::packet::Packet:
roc::core::RefCounted< Packet, core::FactoryAllocation< PacketFactory > > roc::core::ListNode roc::core::MpscQueueNode roc::core::NonCopyable< T > roc::core::FactoryAllocation< PacketFactory > roc::core::NonCopyable< ListNode > roc::core::NonCopyable< MpscQueueNode >

Public Types

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

Public Member Functions

 Packet (PacketFactory &)
 Constructor.
 
void add_flags (unsigned flags)
 Add flags.
 
unsigned flags () const
 Get flags.
 
const UDPudp () const
 UDP packet.
 
UDPudp ()
 UDP packet.
 
const RTPrtp () const
 RTP packet.
 
RTPrtp ()
 RTP packet.
 
const FECfec () const
 FEC packet.
 
FECfec ()
 FEC packet.
 
const RTCPrtcp () const
 RTCP packet.
 
RTCPrtcp ()
 RTCP packet.
 
const core::Slice< uint8_t > & data () const
 Get packet data.
 
void set_data (const core::Slice< uint8_t > &data)
 Set packet data.
 
source_t source () const
 Return packet stream identifier.
 
timestamp_t begin () const
 Get the timestamp of the first sample in packet.
 
timestamp_t end () const
 Get the timestamp of the last sample in packet plus one.
 
int compare (const Packet &other) const
 Determine packet order.
 
void print (int flags) const
 Print packet to stderr.
 
- Public Member Functions inherited from roc::core::RefCounted< Packet, core::FactoryAllocation< PacketFactory > >
 RefCounted ()
 Initialization with default allocation policy.
 
 RefCounted (const core::FactoryAllocation< PacketFactory > &policy)
 Initialization with arbitrary allocation policy.
 
long getref () const
 Get reference counter.
 
void incref () const
 Increment reference counter.
 
void decref () const
 Decrement reference counter.
 
- Public Member Functions inherited from roc::core::ListNode
ListNodeDatalist_node_data () const
 Get list node data.
 
- Public Member Functions inherited from roc::core::MpscQueueNode
MpscQueueDatampsc_queue_data () const
 Get list node data.
 

Static Public Member Functions

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

Additional Inherited Members

- Protected Member Functions inherited from roc::core::FactoryAllocation< PacketFactory >
PacketFactory & factory () const
 Get factory.
 
 FactoryAllocation ()
 Initialize in invalid state. Such instance wont be usable.
 
 FactoryAllocation (PacketFactory &factory)
 Initialize with given factory. Such instance will use factory to destroy objects.
 
void destroy (T &object)
 Destroy object and deallocate its memory.
 

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.

FlagComposed 

Packet is already composed.

FlagRestored 

Packet was restored using FEC decoder.

Definition at line 46 of file packet.h.

Constructor & Destructor Documentation

◆ Packet()

roc::packet::Packet::Packet ( PacketFactory )
explicit

Constructor.

Member Function Documentation

◆ add_flags()

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

Add flags.

◆ begin()

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 125 of file packet.h.

◆ data()

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

Get packet data.

◆ end()

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.

◆ print()

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

Print packet to stderr.

Definition at line 120 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()

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: