The Receiver Report packet is sent by all members of a session that are not sending data. It contains a list of RR_Block to represent each source this party is receiving data from. More...
#include <RTCP_Packet.h>
Public Member Functions | |
RTCP_RR_Packet (char *buffer, int *len) | |
Constructor for incoming receiver reports. | |
RTCP_RR_Packet (ACE_UINT32 ssrc, RR_Block *blocks) | |
Constructor for outgoing receiver reports. | |
virtual | ~RTCP_RR_Packet (void) |
Destructor. | |
unsigned int | packet_size (void) |
Returns the size of the packet in bytes. | |
ACE_INT32 | ssrc (void) |
Returns the synchronization source id of the source sending this packet. | |
void | dump (void) |
Prints the contents of the packet. | |
Private Member Functions | |
void | build_packet (void) |
Used to create the byte representation of the RTCP packet. | |
Private Attributes | |
ACE_UINT32 | ssrc_ |
The synchronization source id of the sender of this report. | |
RR_Block * | rr_ |
A linked list of the receiver report block(s) being sent. |
The Receiver Report packet is sent by all members of a session that are not sending data. It contains a list of RR_Block to represent each source this party is receiving data from.
Definition at line 175 of file RTCP_Packet.h.
RTCP_RR_Packet::RTCP_RR_Packet | ( | char * | buffer, | |
int * | len | |||
) |
Constructor for incoming receiver reports.
Definition at line 294 of file RTCP_Packet.cpp.
:RTCP_Packet (buffer) { unsigned int i = 0; RR_Block *local_block_ptr = 0; this->rr_ = 0; // The common part of the header is initialized in the parent. i=4; this->ssrc_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); i+=4; for (unsigned int j=0; j<this->chd_.count_; j++) { if (j==0) { ACE_NEW (this->rr_, RR_Block); local_block_ptr = this->rr_; } else { ACE_NEW (local_block_ptr->next_, RR_Block); local_block_ptr = local_block_ptr->next_; } local_block_ptr->next_ = 0; local_block_ptr->ssrc_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); i+=4; ACE_UINT32 temp = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); local_block_ptr->fraction_ = (temp&0xff000000) >> 24; local_block_ptr->lost_ = temp & 0x00ffffff; i+=4; local_block_ptr->last_seq_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); i+=4; local_block_ptr->jitter_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); i+=4; local_block_ptr->lsr_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); i+=4; local_block_ptr->dlsr_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); i+=4; } *len-=(this->chd_.length_+1)*4; this->packet_data_ = 0; }
RTCP_RR_Packet::RTCP_RR_Packet | ( | ACE_UINT32 | ssrc, | |
RR_Block * | blocks | |||
) |
Constructor for outgoing receiver reports.
Definition at line 263 of file RTCP_Packet.cpp.
{ RR_Block *block_ptr = blocks; this->chd_.count_ = 0; this->chd_.ver_ = 2; this->chd_.pt_ = RTCP_PT_RR; this->ssrc_ = ssrc; this->rr_ = blocks; while (block_ptr) { this->chd_.count_++; // Can only have 31 receiver reports if (this->chd_.count_ == 31) { block_ptr->next_ = 0; break; } block_ptr = block_ptr->next_; } this->chd_.length_ = static_cast<ACE_UINT16> (1+6*(this->chd_.count_)); // + profile specific extensions ?? this->packet_data_ = 0; }
RTCP_RR_Packet::~RTCP_RR_Packet | ( | void | ) | [virtual] |
Destructor.
Definition at line 346 of file RTCP_Packet.cpp.
{ RR_Block *prev; if (this->rr_) { while (this->rr_) { prev = this->rr_; this->rr_ = this->rr_->next_; delete prev; } } if (this->packet_data_) delete []this->packet_data_; }
void RTCP_RR_Packet::build_packet | ( | void | ) | [private, virtual] |
Used to create the byte representation of the RTCP packet.
Implements RTCP_Packet.
Definition at line 376 of file RTCP_Packet.cpp.
{ int index; RR_Block *local_block_ptr; if (this->packet_data_) delete []this->packet_data_; ACE_NEW (this->packet_data_, char [this->packet_size ()]); index = 0; this->packet_data_[index] = static_cast<char> ((this->chd_.ver_ << 6) | (this->chd_.pad_ << 5) | this->chd_.count_); index++; this->packet_data_[index] = chd_.pt_; index++; *((ACE_UINT16*)&this->packet_data_[index]) = ACE_HTONS(chd_.length_); index+=2; *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(this->ssrc_); index+=4; local_block_ptr = this->rr_; while (local_block_ptr) { *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->ssrc_); index+=4; ACE_UINT32 temp = ACE_HTONL((local_block_ptr->fraction_&0xff) << 24) & local_block_ptr->lost_; *((ACE_UINT32*)&this->packet_data_[index]) = temp; index+=4; *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->last_seq_); index+=4; *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->jitter_); index+=4; *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->lsr_); index+=4; *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->dlsr_); index+=4; local_block_ptr = local_block_ptr->next_; } }
void RTCP_RR_Packet::dump | ( | void | ) |
Prints the contents of the packet.
Definition at line 421 of file RTCP_Packet.cpp.
{ RR_Block *b = this->rr_; int count = 1; ACE_DEBUG ((LM_DEBUG, "\nRTCP_RR_Packet:: from %u - %d rr blocks follow.\n", this->ssrc_, this->chd_.count_)); while (b) { ACE_DEBUG ((LM_DEBUG, " Block %d: ssrc %u; frac %u; lost %u; last seq %u\n", count, b->ssrc_, b->fraction_, b->lost_, b->last_seq_)); ACE_DEBUG ((LM_DEBUG, " jitter %u; lsr %u; dlsr %u;\n", b->jitter_, b->lsr_, b->dlsr_)); b = b->next_; ++count; } }
unsigned int RTCP_RR_Packet::packet_size | ( | void | ) | [virtual] |
Returns the size of the packet in bytes.
Implements RTCP_Packet.
Definition at line 367 of file RTCP_Packet.cpp.
ACE_INT32 RTCP_RR_Packet::ssrc | ( | void | ) | [inline] |
Returns the synchronization source id of the source sending this packet.
Definition at line 191 of file RTCP_Packet.h.
{ return this->ssrc_; }
RR_Block* RTCP_RR_Packet::rr_ [private] |
A linked list of the receiver report block(s) being sent.
Definition at line 204 of file RTCP_Packet.h.
ACE_UINT32 RTCP_RR_Packet::ssrc_ [private] |
The synchronization source id of the sender of this report.
Definition at line 201 of file RTCP_Packet.h.