SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Member Functions | Private Attributes | List of all members
qrtplib::RTCPRRPacket Class Reference

#include <rtcprrpacket.h>

+ Inheritance diagram for qrtplib::RTCPRRPacket:
+ Collaboration diagram for qrtplib::RTCPRRPacket:

Public Member Functions

 RTCPRRPacket (uint8_t *data, std::size_t datalen)
 
 ~RTCPRRPacket ()
 
uint32_t GetSenderSSRC () const
 
int GetReceptionReportCount () const
 
uint32_t GetSSRC (int index) const
 
uint8_t GetFractionLost (int index) const
 
int32_t GetLostPacketCount (int index) const
 
uint32_t GetExtendedHighestSequenceNumber (int index) const
 
uint32_t GetJitter (int index) const
 
uint32_t GetLSR (int index) const
 
uint32_t GetDLSR (int index) const
 
- Public Member Functions inherited from qrtplib::RTCPPacket
virtual ~RTCPPacket ()
 
bool IsKnownFormat () const
 
PacketType GetPacketType () const
 
uint8_tGetPacketData ()
 
std::size_t GetPacketLength () const
 

Private Member Functions

RTCPReceiverReportGotoReport (int index) const
 

Private Attributes

RTPEndian m_endian
 

Additional Inherited Members

- Public Types inherited from qrtplib::RTCPPacket
enum  PacketType {
  SR, RR, SDES, BYE,
  APP, Unknown
}
 
- Protected Member Functions inherited from qrtplib::RTCPPacket
 RTCPPacket (PacketType t, uint8_t *d, std::size_t dlen)
 
- Protected Attributes inherited from qrtplib::RTCPPacket
uint8_tdata
 
std::size_t datalen
 
bool knownformat
 

Detailed Description

Describes an RTCP receiver report packet.

Definition at line 54 of file rtcprrpacket.h.

Constructor & Destructor Documentation

◆ RTCPRRPacket()

qrtplib::RTCPRRPacket::RTCPRRPacket ( uint8_t data,
std::size_t  datalen 
)

Creates an instance based on the data in data with length datalen. Creates an instance based on the data in data with length datalen. Since the data pointer is referenced inside the class (no copy of the data is made) one must make sure that the memory it points to is valid as long as the class instance exists.

Definition at line 38 of file rtcprrpacket.cpp.

References qrtplib::RTCPCommonHeader::count, qrtplib::RTCPPacket::knownformat, and qrtplib::RTCPCommonHeader::padding.

38  :
39  RTCPPacket(RR, data, datalength)
40 {
41  knownformat = false;
42 
43  RTCPCommonHeader *hdr;
44  std::size_t len = datalength;
45  std::size_t expectedlength;
46 
47  hdr = (RTCPCommonHeader *) data;
48  if (hdr->padding)
49  {
50  uint8_t padcount = data[datalength - 1];
51  if ((padcount & 0x03) != 0) // not a multiple of four! (see rfc 3550 p 37)
52  return;
53  if (((std::size_t) padcount) >= len)
54  return;
55  len -= (std::size_t) padcount;
56  }
57 
58  expectedlength = sizeof(RTCPCommonHeader) + sizeof(uint32_t);
59  expectedlength += sizeof(RTCPReceiverReport) * ((int) hdr->count);
60 
61  if (expectedlength != len)
62  return;
63 
64  knownformat = true;
65 }
unsigned int uint32_t
Definition: rtptypes_win.h:46
unsigned char uint8_t
Definition: rtptypes_win.h:42
RTCPPacket(PacketType t, uint8_t *d, std::size_t dlen)
Definition: rtcppacket.h:65

◆ ~RTCPRRPacket()

qrtplib::RTCPRRPacket::~RTCPRRPacket ( )
inline

Definition at line 63 of file rtcprrpacket.h.

64  {
65  }

Member Function Documentation

◆ GetDLSR()

uint32_t qrtplib::RTCPRRPacket::GetDLSR ( int  index) const
inline

Returns the DLSR field of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 195 of file rtcprrpacket.h.

References qrtplib::RTCPReceiverReport::dlsr.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

196 {
197  if (!knownformat)
198  return 0;
199  RTCPReceiverReport *r = GotoReport(index);
200  return m_endian.qToHost(r->dlsr);
201 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcprrpacket.h:137
+ Here is the caller graph for this function:

◆ GetExtendedHighestSequenceNumber()

uint32_t qrtplib::RTCPRRPacket::GetExtendedHighestSequenceNumber ( int  index) const
inline

Returns the extended highest sequence number of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 171 of file rtcprrpacket.h.

References qrtplib::RTCPReceiverReport::exthighseqnr.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

172 {
173  if (!knownformat)
174  return 0;
175  RTCPReceiverReport *r = GotoReport(index);
176  return m_endian.qToHost(r->exthighseqnr);
177 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcprrpacket.h:137
+ Here is the caller graph for this function:

◆ GetFractionLost()

uint8_t qrtplib::RTCPRRPacket::GetFractionLost ( int  index) const
inline

Returns the `fraction lost' field of the reception report described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 151 of file rtcprrpacket.h.

References qrtplib::RTCPReceiverReport::fractionlost.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

152 {
153  if (!knownformat)
154  return 0;
155  RTCPReceiverReport *r = GotoReport(index);
156  return r->fractionlost;
157 }
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcprrpacket.h:137
+ Here is the caller graph for this function:

◆ GetJitter()

uint32_t qrtplib::RTCPRRPacket::GetJitter ( int  index) const
inline

Returns the jitter field of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 179 of file rtcprrpacket.h.

References qrtplib::RTCPReceiverReport::jitter.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

180 {
181  if (!knownformat)
182  return 0;
183  RTCPReceiverReport *r = GotoReport(index);
184  return m_endian.qToHost(r->jitter);
185 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcprrpacket.h:137
+ Here is the caller graph for this function:

◆ GetLostPacketCount()

int32_t qrtplib::RTCPRRPacket::GetLostPacketCount ( int  index) const
inline

Returns the number of lost packets in the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 159 of file rtcprrpacket.h.

References qrtplib::RTCPReceiverReport::packetslost.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

160 {
161  if (!knownformat)
162  return 0;
163  RTCPReceiverReport *r = GotoReport(index);
164  uint32_t count = ((uint32_t) r->packetslost[2]) | (((uint32_t) r->packetslost[1]) << 8) | (((uint32_t) r->packetslost[0]) << 16);
165  if ((count & 0x00800000) != 0) // test for negative number
166  count |= 0xFF000000;
167  int32_t *count2 = (int32_t *) (&count);
168  return (*count2);
169 }
unsigned int uint32_t
Definition: rtptypes_win.h:46
int int32_t
Definition: rtptypes_win.h:45
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcprrpacket.h:137
+ Here is the caller graph for this function:

◆ GetLSR()

uint32_t qrtplib::RTCPRRPacket::GetLSR ( int  index) const
inline

Returns the LSR field of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 187 of file rtcprrpacket.h.

References qrtplib::RTCPReceiverReport::lsr.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

188 {
189  if (!knownformat)
190  return 0;
191  RTCPReceiverReport *r = GotoReport(index);
192  return m_endian.qToHost(r->lsr);
193 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcprrpacket.h:137
+ Here is the caller graph for this function:

◆ GetReceptionReportCount()

int qrtplib::RTCPRRPacket::GetReceptionReportCount ( ) const
inline

Returns the number of reception report blocks present in this packet.

Definition at line 129 of file rtcprrpacket.h.

References qrtplib::RTCPCommonHeader::count.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

130 {
131  if (!knownformat)
132  return 0;
133  RTCPCommonHeader *hdr = (RTCPCommonHeader *) data;
134  return ((int) hdr->count);
135 }
+ Here is the caller graph for this function:

◆ GetSenderSSRC()

uint32_t qrtplib::RTCPRRPacket::GetSenderSSRC ( ) const
inline

Returns the SSRC of the participant who sent this packet.

Definition at line 121 of file rtcprrpacket.h.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

122 {
123  if (!knownformat)
124  return 0;
125 
126  uint32_t *ssrcptr = (uint32_t *) (data + sizeof(RTCPCommonHeader));
127  return m_endian.qToHost(*ssrcptr);
128 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
unsigned int uint32_t
Definition: rtptypes_win.h:46
+ Here is the caller graph for this function:

◆ GetSSRC()

uint32_t qrtplib::RTCPRRPacket::GetSSRC ( int  index) const
inline

Returns the SSRC of the reception report block described by index which may have a value from 0 to GetReceptionReportCount()-1 (note that no check is performed to see if index is valid).

Definition at line 143 of file rtcprrpacket.h.

References qrtplib::RTCPReceiverReport::ssrc.

Referenced by qrtplib::RTPSources::ProcessRTCPCompoundPacket().

144 {
145  if (!knownformat)
146  return 0;
147  RTCPReceiverReport *r = GotoReport(index);
148  return m_endian.qToHost(r->ssrc);
149 }
T qToHost(const T &x) const
Definition: rtpendian.h:27
RTCPReceiverReport * GotoReport(int index) const
Definition: rtcprrpacket.h:137
+ Here is the caller graph for this function:

◆ GotoReport()

RTCPReceiverReport * qrtplib::RTCPRRPacket::GotoReport ( int  index) const
inlineprivate

Definition at line 137 of file rtcprrpacket.h.

138 {
139  RTCPReceiverReport *r = (RTCPReceiverReport *) (data + sizeof(RTCPCommonHeader) + sizeof(uint32_t) + index * sizeof(RTCPReceiverReport));
140  return r;
141 }
unsigned int uint32_t
Definition: rtptypes_win.h:46

Member Data Documentation

◆ m_endian

RTPEndian qrtplib::RTCPRRPacket::m_endian
private

Definition at line 118 of file rtcprrpacket.h.


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