#include <RTCP_Packet.h>
Inheritance diagram for RTCP_RR_Packet:
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. |
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.
References ACE_NEW, ACE_NTOHL, RTCP_Packet::chd_, RTCP_Common_Header::count_, RR_Block::dlsr_, RR_Block::fraction_, RR_Block::jitter_, RR_Block::last_seq_, RTCP_Common_Header::length_, RR_Block::lost_, RR_Block::lsr_, RR_Block::next_, RTCP_Packet::packet_data_, rr_, RR_Block::ssrc_, and ssrc_.
00296 :RTCP_Packet (buffer) 00297 { 00298 unsigned int i = 0; 00299 RR_Block *local_block_ptr = 0; 00300 00301 this->rr_ = 0; 00302 00303 // The common part of the header is initialized in the parent. 00304 i=4; 00305 this->ssrc_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 00306 i+=4; 00307 for (unsigned int j=0; j<this->chd_.count_; j++) 00308 { 00309 if (j==0) 00310 { 00311 ACE_NEW (this->rr_, 00312 RR_Block); 00313 local_block_ptr = this->rr_; 00314 } 00315 else 00316 { 00317 ACE_NEW (local_block_ptr->next_, 00318 RR_Block); 00319 local_block_ptr = local_block_ptr->next_; 00320 } 00321 00322 local_block_ptr->next_ = 0; 00323 local_block_ptr->ssrc_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 00324 i+=4; 00325 ACE_UINT32 temp = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 00326 local_block_ptr->fraction_ = (temp&0xff000000) >> 24; 00327 local_block_ptr->lost_ = temp & 0x00ffffff; 00328 i+=4; 00329 local_block_ptr->last_seq_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 00330 i+=4; 00331 local_block_ptr->jitter_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 00332 i+=4; 00333 local_block_ptr->lsr_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 00334 i+=4; 00335 local_block_ptr->dlsr_ = ACE_NTOHL(*(ACE_UINT32*)&buffer[i]); 00336 i+=4; 00337 } 00338 00339 *len-=(this->chd_.length_+1)*4; 00340 00341 this->packet_data_ = 0; 00342 }
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.
References RTCP_Packet::chd_, RTCP_Common_Header::count_, RTCP_Common_Header::length_, RR_Block::next_, RTCP_Packet::packet_data_, RTCP_Common_Header::pt_, rr_, RTCP_PT_RR, ssrc_, and RTCP_Common_Header::ver_.
00264 { 00265 RR_Block *block_ptr = blocks; 00266 00267 this->chd_.count_ = 0; 00268 this->chd_.ver_ = 2; 00269 this->chd_.pt_ = RTCP_PT_RR; 00270 this->ssrc_ = ssrc; 00271 this->rr_ = blocks; 00272 00273 while (block_ptr) 00274 { 00275 this->chd_.count_++; 00276 00277 // Can only have 31 receiver reports 00278 if (this->chd_.count_ == 31) 00279 { 00280 block_ptr->next_ = 0; 00281 break; 00282 } 00283 00284 block_ptr = block_ptr->next_; 00285 } 00286 00287 this->chd_.length_ = static_cast<ACE_UINT16> (1+6*(this->chd_.count_)); // + profile specific extensions ?? 00288 00289 this->packet_data_ = 0; 00290 }
RTCP_RR_Packet::~RTCP_RR_Packet | ( | void | ) | [virtual] |
Destructor.
Definition at line 346 of file RTCP_Packet.cpp.
References RR_Block::next_, RTCP_Packet::packet_data_, and rr_.
00347 { 00348 RR_Block *prev; 00349 00350 if (this->rr_) 00351 { 00352 while (this->rr_) 00353 { 00354 prev = this->rr_; 00355 this->rr_ = this->rr_->next_; 00356 delete prev; 00357 } 00358 } 00359 00360 if (this->packet_data_) 00361 delete []this->packet_data_; 00362 }
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.
References ACE_HTONL, ACE_HTONS, ACE_NEW, RTCP_Packet::chd_, RTCP_Common_Header::count_, RR_Block::dlsr_, RR_Block::fraction_, RR_Block::jitter_, RR_Block::last_seq_, RTCP_Common_Header::length_, RR_Block::lost_, RR_Block::lsr_, RR_Block::next_, RTCP_Packet::packet_data_, RTCP_Common_Header::pt_, rr_, RR_Block::ssrc_, and RTCP_Common_Header::ver_.
00377 { 00378 int index; 00379 RR_Block *local_block_ptr; 00380 00381 if (this->packet_data_) 00382 delete []this->packet_data_; 00383 00384 ACE_NEW (this->packet_data_, 00385 char [this->packet_size ()]); 00386 00387 index = 0; 00388 this->packet_data_[index] = static_cast<char> ((this->chd_.ver_ << 6) | 00389 (this->chd_.pad_ << 5) | 00390 this->chd_.count_); 00391 index++; 00392 this->packet_data_[index] = chd_.pt_; 00393 index++; 00394 *((ACE_UINT16*)&this->packet_data_[index]) = ACE_HTONS(chd_.length_); 00395 index+=2; 00396 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(this->ssrc_); 00397 index+=4; 00398 00399 local_block_ptr = this->rr_; 00400 while (local_block_ptr) 00401 { 00402 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->ssrc_); 00403 index+=4; 00404 ACE_UINT32 temp = ACE_HTONL((local_block_ptr->fraction_&0xff) << 24) & 00405 local_block_ptr->lost_; 00406 *((ACE_UINT32*)&this->packet_data_[index]) = temp; 00407 index+=4; 00408 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->last_seq_); 00409 index+=4; 00410 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->jitter_); 00411 index+=4; 00412 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->lsr_); 00413 index+=4; 00414 *((ACE_UINT32*)&this->packet_data_[index]) = ACE_HTONL(local_block_ptr->dlsr_); 00415 index+=4; 00416 local_block_ptr = local_block_ptr->next_; 00417 } 00418 }
void RTCP_RR_Packet::dump | ( | void | ) |
Prints the contents of the packet.
Definition at line 421 of file RTCP_Packet.cpp.
References ACE_DEBUG, RR_Block::dlsr_, RR_Block::fraction_, RR_Block::jitter_, RR_Block::last_seq_, LM_DEBUG, RR_Block::lost_, RR_Block::lsr_, RR_Block::next_, rr_, and RR_Block::ssrc_.
Referenced by TAO_AV_RTCP_Callback::receive_control_frame().
00422 { 00423 RR_Block *b = this->rr_; 00424 int count = 1; 00425 00426 ACE_DEBUG ((LM_DEBUG, 00427 "\nRTCP_RR_Packet:: from %u - %d rr blocks follow.\n", 00428 this->ssrc_, 00429 this->chd_.count_)); 00430 00431 while (b) 00432 { 00433 ACE_DEBUG ((LM_DEBUG, 00434 " Block %d: ssrc %u; frac %u; lost %u; last seq %u\n", 00435 count, 00436 b->ssrc_, 00437 b->fraction_, 00438 b->lost_, 00439 b->last_seq_)); 00440 ACE_DEBUG ((LM_DEBUG, 00441 " jitter %u; lsr %u; dlsr %u;\n", 00442 b->jitter_, 00443 b->lsr_, 00444 b->dlsr_)); 00445 00446 b = b->next_; 00447 ++count; 00448 } 00449 }
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.
References RTCP_Packet::chd_, and RTCP_Common_Header::count_.
00368 { 00369 ACE_UINT16 size = static_cast<ACE_UINT16> ((2+this->chd_.count_*6) * 4); 00370 return size; 00371 }
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.
References ssrc_.
Referenced by TAO_AV_RTCP_Callback::receive_control_frame().
00191 { 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.
Referenced by build_packet(), dump(), RTCP_RR_Packet(), and ~RTCP_RR_Packet().
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.
Referenced by RTCP_RR_Packet(), and ssrc().