#include <RTP.h>
Public Member Functions | |
| RTP_Packet (char *buffer, int length) | |
| Constructor for incoming RTP packets. | |
| RTP_Packet (unsigned char padding, unsigned char marker, unsigned char payloadType, ACE_UINT32 sequenceNumber, ACE_UINT32 timeStamp, ACE_UINT32 syncSource, unsigned char contribSourcCount, ACE_UINT32 contribSourceList[], char *data, ACE_UINT16 dataSize) | |
| Constructor for outgoing RTP packets. | |
| ~RTP_Packet (void) | |
| Destructor. | |
| ACE_UINT16 | packet_size (void) |
| Returns the size of the RTP packet in bytes. | |
| ACE_UINT16 | payload_size (void) |
| Returns the size of the payload in bytes. | |
| void | get_frame_info (TAO_AV_frame_info *frame_info) |
| Populates the passed in frame_info. | |
| int | is_valid (void) |
| Returns 1 if packet is valid and 0 if not. | |
| unsigned int | ver (void) |
| Returns the RTP version of the packet. | |
| unsigned int | pad (void) |
| Returns 1 if the padding bit is set, 0 if not. | |
| unsigned int | ext (void) |
| Returns 1 if the header extension bit is set, 0 if not. | |
| unsigned int | ext_bytes (void) |
| Returns the number of bytes in the header extension or 0 if no extension. | |
| unsigned int | cc (void) |
| unsigned int | mrk (void) |
| Returns 1 if the marker bit is set, 0 if not. | |
| unsigned int | pt (void) |
| Returns the payload type of the packet. | |
| ACE_UINT16 | sn (void) |
| Returns the sequence number of the packet. | |
| ACE_UINT32 | ts (void) |
| Returns the timestamp of the packet. | |
| ACE_UINT32 | ssrc (void) |
| Returns the synchronization source id of the packet. | |
| void | get_csrc_list (ACE_UINT32 **csrc_list, ACE_UINT16 &length) |
| void | get_payload (char **payload, ACE_UINT16 &size) |
| void | get_packet_data (char **packet, ACE_UINT16 &size) |
Private Attributes | |
| char | packet_ [RTP_MTU] |
| Local buffer to hold the RTP packet. | |
| ACE_UINT32 | host_byte_order_csrc_list_ [15] |
| char | host_byte_order_payload_ [RTP_MTU] |
| Local buffer to hold the payload with the values stored in host byte order. | |
| unsigned int | extension_bytes_ |
| The number of bytes in the header extension - 0 if no extension. | |
| ACE_UINT16 | packet_size_ |
| The size of the overall data packet. | |
| ACE_UINT16 | payload_size_ |
| The size of the payload portion of the packet. | |
Definition at line 294 of file RTP.h.
|
||||||||||||
|
Constructor for incoming RTP packets.
Definition at line 49 of file RTP.cpp. References cc(), ext(), extension_bytes_, host_byte_order_csrc_list_, host_byte_order_payload_, ACE_OS::memcpy(), packet_, pt(), RTP_PT_L16_MONO, RTP_PT_L16_OTHER, and RTP_PT_L16_STEREO.
00050 {
00051 // skip the standard header info
00052 int index = 12;
00053
00054 ACE_OS::memcpy(this->packet_, buffer, length);
00055
00056 for (int j=0; j<(int)this->cc(); j++)
00057 {
00058 this->host_byte_order_csrc_list_[j] = ntohl(*(ACE_UINT32*)&buffer[index]);
00059 index+=4;
00060 }
00061
00062 // ignore the header extension if there is one
00063 if (this->ext())
00064 {
00065 index+=2;
00066 int extension_data_size = ntohs(*(ACE_UINT16*)&buffer[index]);
00067 index+=2;
00068 index+=extension_data_size;
00069
00070 this->extension_bytes_ = 4 + extension_data_size;
00071 }
00072 else
00073 this->extension_bytes_ = 0;
00074
00075 this->packet_size_ = static_cast<ACE_UINT16> (length);
00076 this->payload_size_ = static_cast<ACE_UINT16> (length-index);
00077
00078 // This is necessary only for payload types that have 16 bit values to correct
00079 // the network byte ordering.
00080 if ((this->pt() == RTP_PT_L16_OTHER) ||
00081 (this->pt() == RTP_PT_L16_STEREO) ||
00082 (this->pt() == RTP_PT_L16_MONO))
00083 {
00084 for (int i=0; i < payload_size_; i+=2)
00085 {
00086 *(ACE_UINT16*)&this->host_byte_order_payload_[i] = ntohs(*(ACE_UINT16*)&this->packet_[index]);
00087 index+=2;
00088 }
00089 }
00090 else
00091 for (int i=0; i<this->payload_size_; i++)
00092 {
00093 this->host_byte_order_payload_[i] = this->packet_[index];
00094 index++;
00095 }
00096 }
|
|
||||||||||||||||||||||||||||||||||||||||||||
|
Constructor for outgoing RTP packets.
|
|
|
Destructor.
Definition at line 178 of file RTP.cpp.
00179 {
00180 }
|
|
|
Returns the contributing source count. This should only be non-zero for mixers. Definition at line 213 of file RTP.cpp. References packet_. Referenced by get_csrc_list(), is_valid(), and RTP_Packet().
00214 {
00215 return ( this->packet_[0] & 0x0F ) ;
00216 }
|
|
|
Returns 1 if the header extension bit is set, 0 if not.
Definition at line 207 of file RTP.cpp. References packet_. Referenced by RTP_Packet().
00208 {
00209 return ( this->packet_[0] & 0x10 ) >> 4;
00210 }
|
|
|
Returns the number of bytes in the header extension or 0 if no extension.
Definition at line 249 of file RTP.cpp. References extension_bytes_.
00250 {
00251 return this->extension_bytes_;
00252 }
|
|
||||||||||||
|
Returns a pointer to the local contributing source list and its length. This should be empty except for mixers. RTP_Packet retains ownership. Definition at line 294 of file RTP.cpp. References cc(), and host_byte_order_csrc_list_.
00295 {
00296 *csrc_list = this->host_byte_order_csrc_list_;
00297 length = static_cast<ACE_UINT16> (this->cc ());
00298 }
|
|
|
Populates the passed in frame_info.
Definition at line 255 of file RTP.cpp. References TAO_AV_frame_info::format, mrk(), pt(), TAO_AV_frame_info::sequence_num, sn(), ssrc(), TAO_AV_frame_info::ssrc, TAO_AV_frame_info::timestamp, and ts(). Referenced by TAO_AV_RTP_Object::handle_input().
|
|
||||||||||||
|
Returns a pointer to the locally stored rtp packet and its size in bytes. RTP_Packet retains ownership. Definition at line 308 of file RTP.cpp. References packet_. Referenced by TAO_AV_RTP_Object::send_frame().
00309 {
00310 *packet = this->packet_;
00311 length = this->packet_size_;
00312 }
|
|
||||||||||||
|
Returns a pointer to the locally stored payload and its size in bytes. The payload is returned in host byte order. RTP_Packet retains ownership. Definition at line 301 of file RTP.cpp. References host_byte_order_payload_. Referenced by TAO_AV_RTP_Object::handle_input().
00302 {
00303 *payload = this->host_byte_order_payload_ ;
00304 length = this->payload_size_;
00305 }
|
|
|
Returns 1 if packet is valid and 0 if not.
Definition at line 265 of file RTP.cpp. References cc(), extension_bytes_, packet_, pad(), pt(), RTCP_PT_RR, RTCP_PT_SR, RTP_VERSION, and ver(). Referenced by RTCP_Channel_In::recv_rtp_packet().
00266 {
00267 // taken from RFC 1889 - Appendix A.1
00268
00269 // make sure the RTP version is correct
00270 if (this->ver() != RTP_VERSION)
00271 return 0;
00272
00273 // make sure the payload type is not SR or RR
00274 if ((this->pt() == RTCP_PT_SR) || (this->pt() == RTCP_PT_RR))
00275 return 0;
00276
00277 // if the p bit is set, the last octet of the packet must contain a valid
00278 // octet count, in particular, less than the total packet length minus
00279 // the header size.
00280 if (this->pad() != 0)
00281 if ((unsigned int)this->packet_[this->packet_size_] >=
00282 (this->packet_size_ - (12 + this->cc() + this->extension_bytes_)))
00283 return 0;
00284
00285 // If there is an extension, it is ignored (taken care of in constructor)
00286
00287 // The length of the packet must be consistent with CC and payload type (if
00288 // payloads have a known length)
00289
00290 return 1;
00291 }
|
|
|
Returns 1 if the marker bit is set, 0 if not.
Definition at line 219 of file RTP.cpp. References packet_. Referenced by get_frame_info().
00220 {
00221 return ( this->packet_[1] & 0x80 ) >> 7;
00222 }
|
|
|
Returns the size of the RTP packet in bytes.
Definition at line 183 of file RTP.cpp.
00184 {
00185 return this->packet_size_;
00186 }
|
|
|
Returns 1 if the padding bit is set, 0 if not.
Definition at line 201 of file RTP.cpp. References packet_. Referenced by is_valid().
00202 {
00203 return ( this->packet_[0] & 0x20 ) >> 5;
00204 }
|
|
|
Returns the size of the payload in bytes.
Definition at line 189 of file RTP.cpp. Referenced by RTCP_Channel_Out::updateStatistics().
00190 {
00191 return this->payload_size_;
00192 }
|
|
|
Returns the payload type of the packet.
Definition at line 225 of file RTP.cpp. References packet_. Referenced by get_frame_info(), is_valid(), RTP_Packet(), and RTCP_Channel_In::updateStatistics().
00226 {
00227 return ( this->packet_[1] & 0x7F ) ;
00228 }
|
|
|
Returns the sequence number of the packet.
Definition at line 231 of file RTP.cpp. Referenced by get_frame_info(), RTCP_Channel_Out::updateStatistics(), and RTCP_Channel_In::updateStatistics().
00232 {
00233 return ntohs(*(ACE_UINT16*)(&this->packet_[2])) ;
00234 }
|
|
|
Returns the synchronization source id of the packet.
Definition at line 243 of file RTP.cpp. Referenced by get_frame_info(), and TAO_AV_RTCP_Callback::receive_frame().
00244 {
00245 return ntohl(*(ACE_UINT32*)(&this->packet_[8])) ;
00246 }
|
|
|
Returns the timestamp of the packet.
Definition at line 237 of file RTP.cpp. Referenced by get_frame_info(), RTCP_Channel_Out::updateStatistics(), and RTCP_Channel_In::updateStatistics().
00238 {
00239 return ntohl(*(ACE_UINT32*)(&this->packet_[4])) ;
00240 }
|
|
|
Returns the RTP version of the packet.
Definition at line 195 of file RTP.cpp. References packet_. Referenced by is_valid().
00196 {
00197 return ( this->packet_[0] & 0xC0 ) >> 6;
00198 }
|
|
|
The number of bytes in the header extension - 0 if no extension.
Definition at line 385 of file RTP.h. Referenced by ext_bytes(), is_valid(), and RTP_Packet(). |
|
|
Local buffer to hold the contributing source list with the values stored in host byte order. Definition at line 379 of file RTP.h. Referenced by get_csrc_list(), and RTP_Packet(). |
|
|
Local buffer to hold the payload with the values stored in host byte order.
Definition at line 382 of file RTP.h. Referenced by get_payload(), and RTP_Packet(). |
|
|
Local buffer to hold the RTP packet.
Definition at line 375 of file RTP.h. Referenced by cc(), ext(), get_packet_data(), is_valid(), mrk(), pad(), pt(), RTP_Packet(), and ver(). |
|
|
The size of the overall data packet.
|
|
|
The size of the payload portion of the packet.
|
1.3.6